diff options
author | Erik Fonselius <fonsan@gmail.com> | 2011-05-29 17:38:01 +0200 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-31 20:47:30 +0100 |
commit | a5806fa409ff286e86eb9fabcee25d083892606f (patch) | |
tree | c8c362d28a6fceb3354412afc7d488c1d475dd80 | |
parent | dfaad4f5a78b2e21a3b86e0daea3afb3b483dc5e (diff) | |
download | rails-a5806fa409ff286e86eb9fabcee25d083892606f.tar.gz rails-a5806fa409ff286e86eb9fabcee25d083892606f.tar.bz2 rails-a5806fa409ff286e86eb9fabcee25d083892606f.zip |
Failing test for aggregating on default_scope with select
-rw-r--r-- | activerecord/test/cases/relation_scoping_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/models/developer.rb | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb index 8f8e72f052..0997a81a8a 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -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 diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index 41c52f7df0..98d6aa22f7 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -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' |