-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Is it possible to ignore all adapters? #935
Comments
JSON API isn't the default on v0.10. At least not yet (or not anymore #930 ). By default it will format as json by rendering attributes and attributes of associations. The serializers allow you to define WHAT (attributes and associations) would be serialized whereas the adapter basically allow you to define HOW they are serialized. Using adapters also allow you to add your own output format if need be. For example, you could write your own XML format that would output your serialized objects as XML. |
Thank for the breakdown, but I think I am still a little confused. You say that there isn't a default adapter for v0.10, but without doing anything else aside from switching from v0.8.3 to v0.10, this app_label end point went from outputting this:
To this:
I understand the technical benefits of the latter, but it's just not plausible at this time to rewrite the front ends to receive that new json data format. Is it possible for v0.10 to output like the former? |
You can try setting the config: ActiveModel::Serializer.config.adapter = :json |
And where is the best place to put that? |
If you use Rails, then |
Awesome. That did the trick! In my mind that seems like there IS a default adapter then, right? |
BTW are you using |
I'm using
|
Then try |
That did it! Wow. So, that was a recent change? Thanks for all your help! |
Yep, it was changed to JSON API 3 weeks days ago and then reverted a few days ago 😉 |
I am working on a large rails-api project with AMS v0.8.3 that currently has 2 native apps and a front-end web app. I am interested in upgrading to AMS v0.10.0 for some of the new features (primarily caching), but then it forces us into the JSON API adapter and essentially renders our end points useless without a substantial rewrite of all the front ends. Is it possible to override the default adapter to the "standard" that existed with v0.8.3?
The concept of adapters is new to me with AMS v0.10.0 and I see that the JSON API just hit v1.0 a couple days ago. It's exciting, but not practical to try to implement it right now.
The text was updated successfully, but these errors were encountered: