We're using active_model_serializers - 0.8.1 in a Rails application.
The app has some API specific controllers inheriting from ActionController::Metal in a way similar to rails-api's ActionController::API.
Well we want to use ActiveModel::Serializers only for the API controllers mentioned above.
Is that possible, how?
Note:
As mentioned in the documentation use of a serializer can explicitly be avoided by replacing
render :json
with:
render :json => @your_object.to_json
We are seeking a more elegant solution than the one above.
Thanks.
For people who encounter this question in the future, adding adapter: nil
to the render: json...
will work (instead of serializer: nil
)
You can also do:
respond_with @your_object, serializer: nil
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