mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
25 lines
533 B
Ruby
25 lines
533 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::NullAdapter.new(object)
|
|
|
|
super(adapter, options)
|
|
else
|
|
super
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|