diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-07-06 00:49:05 -0700 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-07-06 00:49:05 -0700 |
commit | 2c72830cd97d3746dc02db71441e888678f10a86 (patch) | |
tree | c8e51594f2f5698cc01ddd929054f1e3c5a1f32b /activerecord/test | |
parent | a990b1223b88e5424addb5c5c3b1836423a77515 (diff) | |
parent | e7bec4e435d05eb517f515a4661186ce8d088238 (diff) | |
download | rails-2c72830cd97d3746dc02db71441e888678f10a86.tar.gz rails-2c72830cd97d3746dc02db71441e888678f10a86.tar.bz2 rails-2c72830cd97d3746dc02db71441e888678f10a86.zip |
Merge pull request #1979 from bogdan/association_sum_array_compatibility
Fixed AR::Relation#sum compatibility with Array#sum
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 56f6d795b6..224b3f3d1f 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -397,6 +397,10 @@ class CalculationsTest < ActiveRecord::TestCase Account.sum(:credit_limit, :from => 'accounts', :conditions => "credit_limit > 50") end + def test_sum_array_compatibility + assert_equal Account.sum(:credit_limit), Account.sum(&:credit_limit) + end + def test_average_with_from_option assert_equal Account.average(:credit_limit), Account.average(:credit_limit, :from => 'accounts') assert_equal Account.average(:credit_limit, :conditions => "credit_limit > 50"), |