mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Nest scope under context option
This commit is contained in:
committed by
Santiago Pastorino
parent
8bd2542ed2
commit
0d8ef2b165
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user