aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-11-09 12:09:37 +0000
committerJon Leighton <j@jonathanleighton.com>2012-11-09 12:09:37 +0000
commitedd94cee9af1688dd036fc58fd405adb30a5e0da (patch)
tree84decda9a75027ac05235930ea166dc1755bb890 /activerecord/test/cases
parent11b846eefb1e7128ae9c63035f6d559d50bd4563 (diff)
downloadrails-edd94cee9af1688dd036fc58fd405adb30a5e0da.tar.gz
rails-edd94cee9af1688dd036fc58fd405adb30a5e0da.tar.bz2
rails-edd94cee9af1688dd036fc58fd405adb30a5e0da.zip
Delegate all calculations to the scope.
So that the scope may be a NullRelation and return a result without executing a query. Fixes #7928
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index baf07f352e..aae93bb9d0 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1656,6 +1656,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal [], post.comments
assert_equal [], post.comments.where(body: 'omg')
assert_equal [], post.comments.pluck(:body)
+ assert_equal 0, post.comments.sum(:id)
end
end
end