awesome nested set for rails 3 using mongomapper
i want to use awesome nested set for rails 3 using mongomapper in my app. i have seen mongo nested set gem and added it to my gemfile and bundle install.
Then i add acts_as_nested_set to my mongomapper model and i get error :
NameError: undefined local variable or method `acts_as_nested_set'
Is this for rails 3 ? Am i missing something to include this gem into my model or something ?
Or does anyone know of a better solution for mongomappe开发者_开发问答r ?
EDIT : Got this error fixed by including the MongoNestedSet like this :
class Category
include MongoMapper::Document
include MongoNestedSet
acts_as_nested_set
key :name, String, :required => true
key :parent_id, String
key :lft, Integer
key :rgt, Integer
end
but now when i try Category.create!(:name => 'Science') i get the following error :
NoMethodError: undefined method `rgt' for []:Array
from /Users/aaaa/.rvm/gems/ruby-1.9.2-p180/gems/mongo_nested_set-0.1.1/lib/mongo_nested_set.rb:440:in `set_default_left_and_right'
Any one please help with this ?
thanks rick
I am new to rails and I had a similar problem with acts_as_nested_set
I just edited the Gemfile and added the following line:
gem 'awesome_nested_set'
The error message disappeared!
精彩评论