-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
There is a problem with cloning model with localized fields:
class ModelB < SubclassWithMongoid
field :title, localize: true
end
m = Model.new(title: "Hello")
m.title => "Hello"
mc = m.clone
mc.title => "
I think is because of:
https://github.com/mongoid/mongoid/blob/master/lib/mongoid/copyable.rb#L21
First document is transformed to hash like:
{"_id"=>"510ba9e6a46d822ace000002", title => { "en" => "hello" }
, _type => "ModelB" }
It should be this:
{"_id"=>"510ba9e6a46d822ace000002", title_translations =>
, _type => "ModelB" }