2011-08-18 3 views
1

私はあなたのアプリでmongomapperを使用してレール3のための素晴らしいネストセットを使いたいです。私はmongoのネストされたセット宝石を見て、それを私のgemfileとbundle installに追加しました。すごくネストされたセット3のmongomapperを使用して

それから私は私のmongomapperモデルにacts_as_nested_setを追加し、私はエラーを取得:

NameError: undefined local variable or method `acts_as_nested_set' 

はレール3のために、このですか?私のモデルや何かにこの宝石を入れるために何かが欠けていますか?

また、誰かがmongomapperのためのより良い解決策を知っていますか?

EDIT:

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 

が、今私はCategory.createをしようとする!(::名=> '科学')このエラーは、次のようにMongoNestedSetを含むことにより、固定ガット私は次のエラーを取得する:

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' 

いずれかお手伝いしますか?

おかげ リック

私はレールに新しいですし、私はちょうどGemfileに編集

acts_as_nested_setと同様の問題があって、次の行を追加

答えて

1

gem 'awesome_nested_set' 

エラーをメッセージが消えた!

関連する問題