-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
If this is a duplicate, I'm sorry in advance. If document has an invalid embedded association, it cannot save other attributes.
class Item
include Mongoid::Document
embeds_many :urls
field :title
end
class Url include Mongoid::Document embedded_in :item field :value validates :value, uniqueness: true end
describe Item do it 'does not save title' do item = Item.create item.urls.create(value: 'url') item.urls.create(value: 'url') expect(item.update_attributes(title: 'title')).to eq false end end
reload solve this problem. But this is expected? If this is, I'm OK and please close this issue. I just want to inform this behavior. Thank you.