diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-31 21:09:25 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-31 21:12:20 +0100 |
commit | fbe012e92d7792e1307b6ccaab933ea78f635a0b (patch) | |
tree | 6cd5044d9f2e2aae82d1d26bc5c6ca60cd57f84f /activerecord/test | |
parent | a5806fa409ff286e86eb9fabcee25d083892606f (diff) | |
download | rails-fbe012e92d7792e1307b6ccaab933ea78f635a0b.tar.gz rails-fbe012e92d7792e1307b6ccaab933ea78f635a0b.tar.bz2 rails-fbe012e92d7792e1307b6ccaab933ea78f635a0b.zip |
Ensure that calculations properly override the select value even if it's set in the default scope. Fixes #1395.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation_scoping_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb index 0997a81a8a..83bc472764 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -475,6 +475,11 @@ class DefaultScopingTest < ActiveRecord::TestCase assert_equal DeveloperWithSelect.all.count, DeveloperWithSelect.count end + def test_default_scope_select_ignored_by_grouped_aggregations + assert_equal Hash[Developer.all.group_by(&:salary).map { |s, d| [s, d.count] }], + DeveloperWithSelect.group(:salary).count + end + def test_default_scope_order_ignored_by_aggregations assert_equal DeveloperOrderedBySalary.all.count, DeveloperOrderedBySalary.count end |