You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is a multiple referenced resource A which has_one another resource B, the resource B is included only by declaring the inclusion through the "first path", for example "first_reference.resource_a.resource_b".
Steps to reproduce
Given the models
classDummyA < ActiveModelSerializers::Modelattr_accessor:group,:elementdefid'DummyA'endendclassDummyB < ActiveModelSerializers::Modelattr_accessor:parentdefid'DummyB'endendclassDummyC < ActiveModelSerializers::Modelattr_accessor:categorydefid'DummyC'enddefnameputs'DummyC#name was called''name'endendclassDummyD < ActiveModelSerializers::Modeldefid'DummyD'enddefnameputs'DummyD#name was called''name'endend
which has DubbyC and DummyB only. My suspect is that since dummyC was referenced by dummyA (without the dummyD inclusion), the inclusion through DummyB use the previous cached version of dummyC, without the dummyD inclusion.
Does it make sense?
Environment
ActiveModelSerializers Version (commit ref if not on tag): v0.10.13
Integrated application and version (e.g., Rails, Grape, etc): Rails 6.1.5
The text was updated successfully, but these errors were encountered:
TeamNautilus
changed the title
Include doesnt include the resource when multiple reference
Include doesnt include the resource when multiple references
May 2, 2022
Expected behavior vs actual behavior
If there is a multiple referenced resource A which
has_one
another resource B, the resource B is included only by declaring the inclusion through the "first path", for example "first_reference.resource_a.resource_b".Steps to reproduce
Given the models
serializers
and in the controller:
I would expect the following (Note the inclusion of dummyD, the element.parent.category element)
but instead I get
which has DubbyC and DummyB only. My suspect is that since dummyC was referenced by dummyA (without the dummyD inclusion), the inclusion through DummyB use the previous cached version of dummyC, without the dummyD inclusion.
Does it make sense?
Environment
ActiveModelSerializers Version (commit ref if not on tag): v0.10.13
Output of
ruby -e "puts RUBY_DESCRIPTION"
: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]OS Type & Version: Debian 10
Integrated application and version (e.g., Rails, Grape, etc): Rails 6.1.5
The text was updated successfully, but these errors were encountered: