Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
7.0.6, 7.1.0
-
None
Description
ActiveModel has a knob called include_root_in_json (documented in https://api.rubyonrails.org/classes/ActiveModel/Serializers/JSON.html) which controls the structure of the as_json method output. This knob is supported by Mongoid but its values are not being read correctly.
Test case: https://github.com/p-mongo/tests/blob/master/mongoid-app/lib/tasks/test_4865.rake
Output:
|
Mongoid: false
|
Foo: false
|
foo: false
|
Sub: false
|
sub: false
|
|
Mongoid -> true
|
|
Mongoid: true
|
Foo: false
|
foo: true
|
Sub: false
|
sub: true
|
|
Foo -> true
|
|
Mongoid: false
|
Foo: true
|
foo: false
|
Sub: true
|
sub: false
|
|
Sub -> true
|
|
Mongoid: false
|
Foo: false
|
foo: false
|
Sub: true
|
sub: false
|
|
The class level value is not influenced by the global Mongoid value, and the instance value is not influenced by the class level value.
Attachments
Issue Links
- is related to
-
MONGOID-4849 ActiveSupport delegation no longer works with 7.1.0 (conflicts with Forwardable.delegate)
-
- Closed
-
- links to