mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
In a controller, the current controller name should be the default root for collections
This commit is contained in:
@@ -37,6 +37,10 @@ module ActionController
|
||||
end
|
||||
|
||||
def _render_option_json(json, options)
|
||||
if json.is_a?(Array)
|
||||
options[:root] ||= controller_name
|
||||
end
|
||||
|
||||
if json.respond_to?(:active_model_serializer) && (serializer = json.active_model_serializer)
|
||||
json = serializer.new(json, serialization_scope, options)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user