Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

undefined method `fetch' for false:FalseClasserProfile: AND no implicit conversion of nil into Stringr UserProfile: #24

Open
jpwynn opened this issue Apr 13, 2015 · 3 comments

Comments

@jpwynn
Copy link

jpwynn commented Apr 13, 2015

When I reap simple tables with no associations it seems to work fine, for example if I reap ONLY User and Community, individually, or together.

However, when I try to reap User, Community, AND UserProfile I consistently get one of the following two errors (depending upon what subset of the data I try to reap):

no implicit conversion of nil into Stringr UserProfile:
(possible clue: that extra 'r' after the word String?)
or
undefined methodfetch' for false:FalseClasserProfile:`

the UserProfile table has 2 'parent' tables:
belongs_to :user
accepts_nested_attributes_for :user
belongs_to :community
accepts_nested_attributes_for :community
(User has_one :user_profile, and COmmunity has_many :user_profiles)

Even when I define a method self.for_seed_db which is so specific it selects a single User and UserProfile, and run

rake db:seed:reap TARGET_ENV=development MODELS=UserProfile.for_seed_db,User.for_seed_db,Community

I get the error no implicit conversion of nil into Stringr UserProfile:
but it correctly reaps the single User and the set of Communities.

Adding OMIT_EMPTY_ATTRS=true doesn't help.

Any thoughts what could prevent a specific table from being reaped and giving either of those two errors?

Rails 3.2.21, ruby 2.1.5, running on a Mac.

@h0tl33t
Copy link
Contributor

h0tl33t commented Apr 13, 2015

I dug around and couldn't figure out any points of failure in Sprig-Reap that would throw those errors. Are the classes referenced in those errors, Stringr and FalseClasserProfile, defined in your application?

Sprig-Reap appears to be calling methods from your application code on things that are nil or false. It's hard for me to tell what exactly those method calls are without more context or a bigger stack trace.

Could you either show me the User & UserProfile models or a bigger stack trace to see if it sheds any light on where the error is originating from?

@jpwynn
Copy link
Author

jpwynn commented Apr 13, 2015

Hi neither Stringr nor FalseClasserProfile occur in our source code anywhere. I'll work on getting a detailed stack trace, thanks. The stringr thing made me wonder if it's possible there's a typo in your code that under certain conditions a nil object is being converted to class called stringr instead of string.

@dholdren
Copy link
Contributor

the error messages are misleading, the output is actually getting overwritten, see this PR: #26

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants