-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
model MyModel include Mongoid::Document embeds_one :foo, autobuild: true end model = MyModel.new model.as_json.include?(:foo) # => false model.foo # <#Foo:...> model.as_json.include?(:foo) # => true
One would expect embeded thing always to be included in serialized hash. It could be fixed by eagerly loading autobuild embeds before serializing. Something like this:
class Model def serializable_hash(*) eager_load_all_autobuilds super end end