-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Hi,
I'm noticing a bug with the following when JSON serializing Embedded Relations:
class Foo
include Mongoid::Document
embeds_many :bars
end
class Bar
include Mongoid::Document
embedded_in :foo
belongs_to :baz
end
class Baz
include Mongoid::Document
end
doesnt_include_full_baz_object = Foo.new.tap do |f|
f.bars << Bar.new(baz: Baz.create)
f.save
end.to_json include: {
bars: {
baz: {}
}
}
- This includes just the baz_id but not the full baz document itself
doesnt_include_full_baz_object
I can currently work around this but I would've expected the JSON serializer to return a full Baz document.