We've got an API built with Grape and Active Model Serializers 0.8. Now we would like to use all the caching goodness from 0.10, so a migration to the new backwards-incompatible version is in progress.
There are currently two issues right now:
It doesn't seem possible to redefine the root key with self.root=
inside serializers. E.g. we've got SimpleUserSerializer
and we want the root key to user
instead of simple_user
. A solution is to specify the root when rendering the serializer, but then we need to make the change in many places. Is there a way to redefine the root key for this serializers regardless of where/how it's rendered?
embed :ids, include: true
option is not supported and should probably be implemented through an adapter. Are there any plans on releasing or maintaining 0.8-compatible adapter for legacy projects?
Any guidance about the migration would be helpful as I couldn't find any official documentation.
The first issue can be resolved by defining class method root_name
which returns the root key. This can be seen in fixtures in AMS tests.
Still working on the second issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With