blob: 9bb665a9ae4f6a45b40b940256aebef75eaaeb2e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
module ActionController
module Serialization
extend ActiveSupport::Concern
include ActionController::Renderers
included do
class_attribute :_serialization_scope
end
def serialization_scope
send(_serialization_scope)
end
def _render_option_json(json, options)
json = json.active_model_serializer.new(json, serialization_scope) if json.respond_to?(:active_model_serializer)
super
end
module ClassMethods
def serialization_scope(scope)
self._serialization_scope = scope
end
end
end
end
|