1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Extract deprecated code

This commit is contained in:
Jon Leighton 2012-04-22 11:44:55 +02:00
parent ef1d1e1492
commit 618c5fc3c0
2 changed files with 13 additions and 9 deletions

View file

@ -29,17 +29,16 @@ module ActiveRecord
# You can define a \scope that applies to all finders using
# ActiveRecord::Base.default_scope.
def scoped(options = nil)
if options
scoped.apply_finder_options(options)
if current_scope
scope = current_scope.clone
else
if current_scope
current_scope.clone
else
scope = relation
scope.default_scoped = true
scope
end
scope = relation
scope.default_scoped = true
scope
end
scope.merge!(options) if options
scope
end
##

View file

@ -2087,4 +2087,9 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal record, klass.public_send(meth, :foo, :bar)
end
end
test "scoped can take a values hash" do
klass = Class.new(ActiveRecord::Base)
assert_equal ['foo'], klass.scoped(select: 'foo').select_values
end
end