私はここで何が欠けていますか?私がしなければMongoid、埋め込みドキュメントでバージョン管理を行うことはできませんか?
Class Content
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
field :title
embeds_many :localized_contents
end
Class LocalizedContent
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
include Mongoid::Versioning
field :locale
field :content
embedded_in :content, :inverse_of => :localized_contents
end
:
私はここに相対シンプルな構造を持っている
test = LocalizeContent.new(:locale => 'en', :content => 'blah')
test.save
=> ok, version = 1
test.content = 'blah2'
test.save
=> ok, version = 2, versions.count = 1, etc.
すべては、私がコンテンツを介してこれを行う場合、それは動作しません。今すぐOK
ある
test = Content.first.localised_contents.build(:locale => 'en', :content => 'blah')
test.save
=> ok, version = 1
test = Content.first.localized_contents.first
test.content = 'blah2'
test.save
=> KO, version = 1, versions.count = 0, but
Content.first.localized_contents.first.content == 'blah2'
私は何ですか?ここで間違っていますか?!?
おかげで、 アレックス