Search code examples
ruby-on-railsrubyruby-on-rails-3nestednested-sets

Rails 3, Awesome Nested Set, undefined method `parent_id_changed?' for #<Post:0x56f87d0>


I've installed Awesome Nested Set, but something weird happens when I try to create any object that has acts_as_nested_set.

 undefined method `parent_id_changed?' for #<Post:0x5671830>

in this line:

 @post = Post.create!(params[:post])

Similarly, I get undefined method `parent_id_changed?' for comments and nested comments:

 @comment = Comment.create!(params[:comment])
 @comment.move_to_child_of(@post)

Solution

  • It looks like you're missing a field called parent_id on the comments table.