Nest scope under context option

This commit is contained in:
Adrian Mugnolo and Santiago Pastorino
2014-01-06 15:35:21 -02:00
committed by Santiago Pastorino
parent 8bd2542ed2
commit 0d8ef2b165
9 changed files with 56 additions and 85 deletions

View File

@@ -65,7 +65,7 @@ module ActionController
options = default_serializer_options.merge(options)
if serializer = options.fetch(:serializer, ActiveModel::Serializer.serializer_for(resource))
options[:scope] = serialization_scope unless options.has_key?(:scope)
options[:context] = { scope: serialization_scope }.merge!(options[:context] || {})
options[:resource_name] = controller_name if resource.respond_to?(:to_ary)
serializer.new(resource, options)