aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r--actionpack/lib/action_controller/metal/serialization.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/serialization.rb b/actionpack/lib/action_controller/metal/serialization.rb
index 9bb665a9ae..9fb49f512e 100644
--- a/actionpack/lib/action_controller/metal/serialization.rb
+++ b/actionpack/lib/action_controller/metal/serialization.rb
@@ -13,7 +13,9 @@ module ActionController
end
def _render_option_json(json, options)
- json = json.active_model_serializer.new(json, serialization_scope) if json.respond_to?(:active_model_serializer)
+ if json.respond_to?(:active_model_serializer) && (serializer = json.active_model_serializer)
+ json = serializer.new(json, serialization_scope)
+ end
super
end