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

Failing test for aggregating on default_scope with select

This commit is contained in:
Erik Fonselius 2011-05-29 17:38:01 +02:00 committed by Jon Leighton
parent dfaad4f5a7
commit a5806fa409
2 changed files with 9 additions and 0 deletions

View file

@ -471,6 +471,10 @@ class DefaultScopingTest < ActiveRecord::TestCase
assert_equal 10, DeveloperCalledJamis.unscoped.poor.length
end
def test_default_scope_select_ignored_by_aggregations
assert_equal DeveloperWithSelect.all.count, DeveloperWithSelect.count
end
def test_default_scope_order_ignored_by_aggregations
assert_equal DeveloperOrderedBySalary.all.count, DeveloperOrderedBySalary.count
end

View file

@ -86,6 +86,11 @@ class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base
end
end
class DeveloperWithSelect < ActiveRecord::Base
self.table_name = 'developers'
default_scope select('name')
end
class DeveloperOrderedBySalary < ActiveRecord::Base
self.table_name = 'developers'
default_scope :order => 'salary DESC'