mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 14:29:31 +00:00
25 lines
528 B
Ruby
25 lines
528 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.adapter_for(object)
|
|
|
|
super(adapter, options)
|
|
else
|
|
super
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|