module RestfulJson
The restful_json controller module. This module (RestfulJson::Controller
) is included on ActionController and then each individual controller should call acts_as_restful_json.
Only use acts_as_restful_json in each individual service controller rather than a parent or ancestor class of the service controller. class_attribute’s are supposed to work when you subclass, if you use setters (=, =+ to add to array instead of <<, etc.) but we have seen strange errors about missing columns, etc. related to the model_class, etc. being wrong if you share a parent/ancestor class that acts_as_restful_json and then switch back and forth between controllers. Why? The controller class overrides the shared class_attribute’s when the controller class loads, which other than re-loading via Rails autoload, only happens once; so you hit one controller, then the the other, it starts overwriting/adding to attributes, and then when you hit the first one again, no class method calling on class instantiation is being called, so it is using the wrong model. That is bad, so don’t do that.
The Rails 3.x “would you like fries with that” module that includes:
* ActionController::Serialization * ActionController::StrongParameters * ActionController::Permittance * RestfulJson::Controller
Instead of using this, please consider implementing your own module to include these modules so you have more control over it. And in Rails 4+, don’t use this, because ActionController::StrongParameters might already be included.
Constants
- CONTROLLER_OPTIONS
- VERSION
Public Class Methods
# File lib/restful_json/config.rb, line 27 def configure(&blk); class_eval(&blk); end