Module: ActionController::Serialization
- Extended by:
- ActiveSupport::Concern
- Includes:
- Renderers
- Defined in:
- lib/action_controller/serialization.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary (collapse)
- - (Object) get_serializer(resource, options = {})
- - (Object) serialization_scope
-
- (Boolean) use_adapter?
Deprecated.
Instance Method Details
- (Object) get_serializer(resource, options = {})
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/action_controller/serialization.rb', line 26 def get_serializer(resource, = {}) if !use_adapter? warn 'ActionController::Serialization#use_adapter? has been removed. '\ "Please pass 'adapter: false' or see ActiveSupport::SerializableResource.new" [:adapter] = false end serializable_resource = ActiveModelSerializers::SerializableResource.new(resource, ) serializable_resource.serialization_scope ||= .fetch(:scope) { serialization_scope } serializable_resource.serialization_scope_name = .fetch(:scope_name) { _serialization_scope } # For compatibility with the JSON renderer: `json.to_json(options) if json.is_a?(String)`. # Otherwise, since `serializable_resource` is not a string, the renderer would call # `to_json` on a String and given odd results, such as `"".to_json #=> '""'` serializable_resource.adapter.is_a?(String) ? serializable_resource.adapter : serializable_resource end |
- (Object) serialization_scope
21 22 23 24 |
# File 'lib/action_controller/serialization.rb', line 21 def serialization_scope send(_serialization_scope) if _serialization_scope && respond_to?(_serialization_scope, true) end |
- (Boolean) use_adapter?
Deprecated
42 43 44 |
# File 'lib/action_controller/serialization.rb', line 42 def use_adapter? true end |