Open nscricco opened 8 years ago
it looks like you need to include author
as well in your include parameter.
Would it be useful for fields to be able to filter the attributes on nested associations?
Is this basically backporting JSON API adapter behavior to the Attributes adapter?
Yes, exactly. If you think it's worth adding I am happy to put up a PR for it.
This just further proves the need to unify everything.
Very closely related to https://github.com/rails-api/active_model_serializers/issues/1843
@nscricco Since there's a lot involved, might be best to pick something small and make a lot of small prs. Join us on the amserializers.herokuapp.com slack to discuss .
Expected behavior vs actual behavior
Right now my application has a problem with deeply nested response bodies. Ideally, I would like to keep all the existing associations in the serializers and limit the attributes of nested associations in the controller.
(see below for full associations)
I know that in the past, the default serializer in Rails < 4.0 one could do the following:
Would it be useful for
fields
to be able to filter the attributes on nested associations?Steps to reproduce
(e.g., detailed walkthrough, runnable script, example application)
I wrote a few tests that can be seen here
Environment
ActiveModelSerializers Version (commit ref if not on tag): 2423ca49995a
Output of
ruby -e "puts RUBY_DESCRIPTION"
: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]OS Type & Version: OS X 10.11.4 (15E2066)