mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
scope option to render takes precedence over serialization_scope
This commit is contained in:
parent
1e7c69c729
commit
424dacb457
@ -52,7 +52,7 @@ module ActionController
|
|||||||
end
|
end
|
||||||
|
|
||||||
if serializer
|
if serializer
|
||||||
options[:scope] = serialization_scope
|
options[:scope] = serialization_scope unless options.has_key?(:scope)
|
||||||
options[:url_options] = url_options
|
options[:url_options] = url_options
|
||||||
json = serializer.new(json, options.merge(default_serializer_options || {}))
|
json = serializer.new(json, options.merge(default_serializer_options || {}))
|
||||||
end
|
end
|
||||||
|
|||||||
@ -133,8 +133,8 @@ class RenderJsonTest < ActionController::TestCase
|
|||||||
|
|
||||||
def render_json_with_serializer_and_scope_option
|
def render_json_with_serializer_and_scope_option
|
||||||
@current_user = Struct.new(:as_json).new(:current_user => true)
|
@current_user = Struct.new(:as_json).new(:current_user => true)
|
||||||
@scope = Struct.new(:as_json).new(:current_user => false)
|
scope = Struct.new(:as_json).new(:current_user => false)
|
||||||
render :json => JsonSerializable.new, :scope => @scope
|
render :json => JsonSerializable.new, :scope => scope
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_json_with_serializer_api_but_without_serializer
|
def render_json_with_serializer_api_but_without_serializer
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user