scope option to render takes precedence over serialization_scope

This commit is contained in:
Ray Cohen 2012-07-28 19:05:45 -04:00
parent 1e7c69c729
commit 424dacb457
2 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ module ActionController
end
if serializer
options[:scope] = serialization_scope
options[:scope] = serialization_scope unless options.has_key?(:scope)
options[:url_options] = url_options
json = serializer.new(json, options.merge(default_serializer_options || {}))
end

View File

@ -133,8 +133,8 @@ class RenderJsonTest < ActionController::TestCase
def render_json_with_serializer_and_scope_option
@current_user = Struct.new(:as_json).new(:current_user => true)
@scope = Struct.new(:as_json).new(:current_user => false)
render :json => JsonSerializable.new, :scope => @scope
scope = Struct.new(:as_json).new(:current_user => false)
render :json => JsonSerializable.new, :scope => scope
end
def render_json_with_serializer_api_but_without_serializer