Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't dup NilClass when trying to add an object to a list #1

Closed
MagmaRules opened this issue Apr 23, 2009 · 1 comment
Closed

can't dup NilClass when trying to add an object to a list #1

MagmaRules opened this issue Apr 23, 2009 · 1 comment

Comments

@MagmaRules
Copy link

Here is my code: http://pastie.org/456077
The first time i run it, it goes ok. The second time it blows up when i add the event to the list.

It seems the second time it passes the "if record['polymorphic_parent_class']" in base.rb. The first time it doesnt enter the if.

can't dup NilClass
/Users/magmarules/Sites/Probono/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/base.rb:14:in dup' /Users/magmarules/Sites/Probono/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/base.rb:14:ininstantiate'
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:635:in find_by_sql' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:635:incollect!'
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:635:in find_by_sql' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1490:infind_every'
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:589:in find' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/associations/has_many_through_association.rb:73:infind_target'
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/associations/association_collection.rb:344:in load_target' /Users/magmarules/Sites/Probono/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/association.rb:19:in<<'
/Users/magmarules/Sites/Probono/lib/tasks/import.rake:222
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in call' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:inexecute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in each' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:inexecute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:insynchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in invoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:ininvoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in invoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:intop_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in each' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:intop_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:intop_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in run' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:instandard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in run' /Library/Ruby/Gems/1.8/gems/rake-0.8.4/bin/rake:31 /usr/bin/rake:19:inload'
/usr/bin/rake:19

@MagmaRules
Copy link
Author

Sorry my bad, i have the object named event and the relation named events and that was the problem.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant