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
- #get_serializer(resource, options = {}) ⇒ Object
- #serialization_scope ⇒ Object
-
#use_adapter? ⇒ Boolean
Deprecated.
Instance Method Details
#get_serializer(resource, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/action_controller/serialization.rb', line 19 def get_serializer(resource, = {}) if !use_adapter? warn 'ActionController::Serialization#use_adapter? has been removed. '\ "Please pass 'adapter: false' or see ActiveSupport::SerializableResource#serialize" [:adapter] = false end ActiveModel::SerializableResource.serialize(resource, ) do |serializable_resource| if serializable_resource.serializer? serializable_resource.serialization_scope ||= serialization_scope serializable_resource.serialization_scope_name = _serialization_scope begin serializable_resource.adapter rescue ActiveModel::Serializer::ArraySerializer::NoSerializerError resource end else resource end end end |
#serialization_scope ⇒ Object
14 15 16 17 |
# File 'lib/action_controller/serialization.rb', line 14 def serialization_scope send(_serialization_scope) if _serialization_scope && respond_to?(_serialization_scope, true) end |
#use_adapter? ⇒ Boolean
Deprecated
41 42 43 |
# File 'lib/action_controller/serialization.rb', line 41 def use_adapter? true end |