active_model_serializers/lib/action_controller/serialization.rb
Tema Bolshakov f00fe5595d * Rename NullAdapter to SimpleAdapter
* Introduce abstract Adapter class
* Organaze test structure to match convemtions
2014-08-27 08:21:08 +04:00

25 lines
535 B
Ruby

require 'active_support/core_ext/class/attribute'
module ActionController
module Serialization
extend ActiveSupport::Concern
include ActionController::Renderers
def _render_option_json(resource, options)
serializer = ActiveModel::Serializer.serializer_for(resource)
if serializer
# omg hax
object = serializer.new(resource)
adapter = ActiveModel::Serializer::Adapter::SimpleAdapter.new(object)
super(adapter, options)
else
super
end
end
end
end