skyeagle / nested_set

Rails 3 support! An awesome replacement for acts_as_nested_set and better_nested_set.
MIT License
170 stars 24 forks source link

parent_id_changed error when Seeding database #23

Closed bcoughlan closed 13 years ago

bcoughlan commented 13 years ago

Windows XP with Rails 3.0.5, Ruby 1.8.6.

I see awesome_nested_set had the same issue, which was patched but no details were given: https://github.com/collectiveidea/awesome_nested_set/issues/closed#issue/22

seeds.rb: v=Video.create( :title=>'Introduction to Python', :filename=>'python.webm', :length=>2111) s1=Section.create( :video_id=>v.id, :title=>'Introduction to Lists', :length=>234) s2=Section.create( :video_id=>v.id, :title=>'FOR and IN', :length=>234) c=Section.create( :video_id=>v.id, :title=>'While loop', :length=>234) c.move_to_child_of(s2) c = Section.create( :video_id=>v.id, :title=>'Range', :length=>234, :index=>0)

rake db:seed --trace:

undefined method parent_id_changed?' for #<Section:0x32d39d8> C:/Ruby187/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:364:inmethod_missing' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods.rb:46:in method_missing' C:/Ruby187/lib/ruby/gems/1.8/gems/nested_set-1.6.4/lib/nested_set/base.rb:530:insend' C:/Ruby187/lib/ruby/gems/1.8/gems/nested_set-1.6.4/lib/nested_set/base.rb:530:in store_new_parent' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:429:in_run_save_callbacks' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/callbacks.rb:277:in create_or_update' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/persistence.rb:39:insave' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/validations.rb:43:in save' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods/dirty.rb:21:insave' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:237:in save' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:289:inwith_transaction_returning_status' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in transaction' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:204:intransaction' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:287:in with_transaction_returning_status' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:237:insave' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:248:in rollback_active_record_state!' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:236:insave' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:498:in create' C:/html5video/db/seeds.rb:15 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:inload' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in load' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:inload_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in new_constants_in' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:inload_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in load' C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:281 C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain' C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in synchronize' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun' C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 C:/Ruby187/bin/rake:19:in `load' C:/Ruby187/bin/rake:19

bcoughlan commented 13 years ago

Ah, apologies. I left parent_id, ltr and gft out of seeds.rb, I assumed they would be nil by default (newbie syndrome).

skyeagle commented 13 years ago

Ok. Never mind.