-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Embedded association not using serializer #2247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What have you tried? Looks pretty straightforward to me |
I figure I'm missing something. I've tried combinations of includes and has_manys, etc. I can't get the "series" data to use the serializer to limit the attributes. I'm assuming it should, but not really sure if an object's serializer is supposed to kick in when the object is embedded in a different class's object. |
Same issue. Explicitly specifying the serializer on a deeply nested association is ignored, and the entire object is serialized. |
Looks like the signature of |
@jughead it doesn't require that and that's not the problem OP is having. OP wants to serialize some of the attributes as JSON objects using an AMS serializer |
Indeed, is that #2030 the right one? |
@jughead points for searching other issues, but no, that's talking about a different interface |
Expected behavior vs actual behavior
I have Instruments containing Series data. Each instrument has 64 series data points. I'd like to have series data embedded in the instrument, rather than side-loaded. When side-loaded, the series data is using its serializer. When embedded, it is not. I'm trying to get the embedded version to use a serializer. I'm using the json_api adapter.
Side-loaded version (is using SeriesSerializer):
Embedded version (is not using SeriesSerializer):
Steps to reproduce
Controller:
render json: instruments, each_serializer: InstrumentSeriesSerializer
Instrument Serializer:
Series Serializer:
Environment
active_model_serializers (0.10.7)
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
Ubuntu 16.04.4 LTS
Rails 5.1.5
Backtrace
Additonal helpful information
The text was updated successfully, but these errors were encountered: