RailsアプリでMongoidを使用しています。レール3.0.10ルビー1.9.2p0
「test」、「link」、「desc」などのフィールドを使おうとすると。
いう
Content.new(:test => 'ggg')
Content.new(:link => 'ggg')
Content.new(:desc => 'ggg')
コンテンツは「Mongoid::Document」を使用したモデルです
次のエラーが発生します。(このエラーはフィールド「テスト」用です)
mongoidは、フィールド名の上にあるコンテンツを関数として使用するライブラリを使用していると思います。
問題が発生する可能性があります。この問題を回避する方法はありますか?
ArgumentError: wrong number of arguments (0 for 2..3)
from /usr/lib/ruby/gems/1.9.1/gems/activemodel-3.0.10/lib/active_model/dirty.rb:155:in `test'
from /usr/lib/ruby/gems/1.9.1/gems/activemodel-3.0.10/lib/active_model/dirty.rb:155:in `attribute_will_change!'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:102:in `block (2 levels) in write_attribute'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:100:in `tap'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:100:in `block in write_attribute'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:170:in `assigning'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:98:in `write_attribute'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:95:in `process_attribute'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:25:in `block in process'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:23:in `each_pair'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:23:in `process'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/document.rb:128:in `block in initialize'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/relations/builders.rb:47:in `building'
from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/document.rb:125:in `initialize'
from (irb):1:in `new'
from (irb):1
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands.rb:23:in `<top (required)>'
from /home/harshal/simple-cms/branches/1.0/script/rails:6:in `require'
from /home/harshal/simple-cms/branches/1.0/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'