diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-03-12 10:23:08 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-03-15 14:15:47 +0100 |
commit | a1bb6c8b06db83546179175b9b2dde7912c86f9b (patch) | |
tree | 136a3a72f5e612b847e953b2ea12bacd53336040 /activerecord/test/cases/calculations_test.rb | |
parent | bfee706b2e8c3f0144588fb034d41c8333bcd88e (diff) | |
download | rails-a1bb6c8b06db83546179175b9b2dde7912c86f9b.tar.gz rails-a1bb6c8b06db83546179175b9b2dde7912c86f9b.tar.bz2 rails-a1bb6c8b06db83546179175b9b2dde7912c86f9b.zip |
rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works.
The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our
Relation API is close to SQL terms I renamed `#uniq` to `#distinct`.
There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue
to work. I also updated the documentation to promote the use of `#distinct`.
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index be49e948fc..443a09f259 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -341,7 +341,8 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal 5, Account.count(:firm_id) end - def test_count_with_uniq + def test_count_with_distinct + assert_equal 4, Account.select(:credit_limit).distinct.count assert_equal 4, Account.select(:credit_limit).uniq.count end |