josevalim/active_model_serializers — Issue #34: Selectively activate serializers on a per-controller basis
Author: jballanc
Created: 2012-01-31 19:59:19+00:00
State: open

We would like to use active_model_serializers for controllers in our app that will be handling API requests. However, we may also have a need to serve JSON responses via non-API controllers (e.g. responding to Ajax requests). If serializers remain in effect for a model in all controllers, this could potentially lead to confusion or bugs.

Two ideas for accomplishing selective activation:

* Require an explicit call to enable the use of serializers in a controller (e.g. `use_json_serializers` in the controller class definition)
* A configuration option that could be set to disable the ActionController mix-in combined with an explicit inclusion (or convenience method as above)