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
I assume this has been discussed several times already, just want to understand whether sideloading is possible with json adapter or works only with json_api adapter?
Current, I have the config as
ActiveModelSerializers.config.tap do |config|
config.embed = :ids
config.embed_in_root = true
end
and after the upgrade, I have changed it to
ActiveModelSerializers.config.adapter = :json
ActiveModelSerializers.config.default_includes = "**" # to include nested resources
I have read from the other posts, that I could get the occupation_ids using this in the PeopleSerializer
def occupation_ids
object.occupations.pluck(:id)
end
But how do I sideload the associations, rather than nesting inside the people?
The text was updated successfully, but these errors were encountered:
kannans5
changed the title
Upgrade AMS from 0.9 to 0.10 and using Ember Active Model Adapter facing problems in embed_in_root
Upgrade AMS from 0.9 to 0.10 and using Ember Active Model Adapter facing problems in side loading
Sep 24, 2020
I assume this has been discussed several times already, just want to understand whether sideloading is possible with json adapter or works only with json_api adapter?
Current, I have the config as
and after the upgrade, I have changed it to
Example:
Taking the reference from here
https://api.emberjs.com/ember-data/1.13/classes/DS.ActiveModelAdapter
This Adapter expects specific settings using ActiveModel::Serializers, embed :ids, embed_in_root: true which sideloads the records.
Earlier if I have has_many relationship defined in the serializer, I would get the occupations side loaded.
Now I am getting the response like this
I have read from the other posts, that I could get the occupation_ids using this in the PeopleSerializer
But how do I sideload the associations, rather than nesting inside the people?
The text was updated successfully, but these errors were encountered: