무엇이 여기에 있습니까?몽고 이드, 포함 된 문서로 버전 작업을 할 수 없습니까?
이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.
모두 지금은 내용을 통해이 작업을 수행 할 경우 확인
, 그것은
작동하지 않습니다 나는 여기에 상대적으로 간단한 구조를 가지고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'
내가 할 일 여기서 틀린거야?!?
덕분에, 알렉스
는