josevalim/active_model_serializers — Issue #37: Use gem without overwriting render
Author: stream7
Created: 2012-02-11 21:43:56+00:00
State: open

Is it somehow possible to revert or even better skip this completely?

ActiveSupport.on_load(:action_controller) do
include ::ActionController::Serialization
end

I like the ease of serializers when I want to include the associations of a model but this is not always necessary in my controllers.

Imagine a backbone app where you would like to initialize your single page app with the main model which includes all associations
something like
new Backbone.View({model: <%= @model_serializer.to_json %>})

but in further requests, e.g. updates in your model, you would want from your controller only the attributes of the model (fields of its own table)

I can skip the serializer in my controller if I call render like this
render json: model.to_json

but I thought it would be nice to be able to globally turn it off.

what do you think?