0
Я пытаюсь связаться с has_one
. У меня есть следующая настройка, использующая мангоид.nil не является символом accepts_nested_attributes_for has_one association
class Foo
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
has_and_belongs_to_many :bars, inverse_of: nil
end
class Bar
include Mongoid::Document
include Mongoid::Paranoia
has_one :magazine, class_name: 'Foo', dependent: :destroy, inverse_of: nil
accepts_nested_attributes_for :magazine
end
Когда я делаю следующее в консоли rails, похоже, я получаю следующий вывод.
r = Bar.new
=> #<Bar _id: 1213 ....
[2] pry(main)> r.foo.build TypeError: nil is not a symbol from
/Users/home/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems
/mongoid-3.1.6/lib/mongoid/attributes.rb:155:in `respond_to?