[Betternestedset-talk] add migration
Alan Wong
alan_kt_wong at yahoo.com
Wed Jul 2 22:38:47 EDT 2008
I'm trying to use the better nested set plugin for the Category model for my CMS application.
Since I want to start on the right foot, my Category model will act as a nested set.
I do all the standard Rails generation work. I generate a model called Category. Modify
a create_categories migration to create a table. Add validation logic to my Category model.
Finally I am trying to prepopulate my database with data.
I'm having trouble with the last step, as migrations seems to reject the method, 'move_to_child_of'
newborn = Category.new(:name =>"new")
newborn.save
newborn.move_to_child_of root
A few questions
1) Does better_nested_set require that I already have acts_as_nested_set installed for me to use it?
2) Why can't I run better_nested_set methods from migrations?
BTW, I'm using Rails 2 and Ruby 1.8
Regards,
Alan
More information about the Betternestedset-talk
mailing list