diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-05-26 10:35:14 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-05-26 10:35:14 +0200 |
commit | adfab2dcf4003ca564d78d4425566dd2d9cd8b4f (patch) | |
tree | 494149351a1e31e7391ee42c859afbdcb35d1f6f /activerecord/test/cases/calculations_test.rb | |
parent | b8c31fd9b94cd8ac2963c252fcca40b29c43e75c (diff) | |
download | rails-adfab2dcf4003ca564d78d4425566dd2d9cd8b4f.tar.gz rails-adfab2dcf4003ca564d78d4425566dd2d9cd8b4f.tar.bz2 rails-adfab2dcf4003ca564d78d4425566dd2d9cd8b4f.zip |
deprecate `Relation#uniq` use `Relation#distinct` instead.
See #9683 for the reasons we switched to `distinct`.
Here is the discussion that triggered the actual deprecation #20198.
`uniq`, `uniq!` and `uniq_value` are still around.
They will be removed in the next minor release after Rails 5.
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 8fc996ee74..b246eae5f5 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -359,7 +359,10 @@ class CalculationsTest < ActiveRecord::TestCase def test_count_with_distinct assert_equal 4, Account.select(:credit_limit).distinct.count - assert_equal 4, Account.select(:credit_limit).uniq.count + + assert_deprecated do + assert_equal 4, Account.select(:credit_limit).uniq.count + end end def test_count_with_aliased_attribute @@ -504,8 +507,8 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal [ topic.written_on ], relation.pluck(:written_on) end - def test_pluck_and_uniq - assert_equal [50, 53, 55, 60], Account.order(:credit_limit).uniq.pluck(:credit_limit) + def test_pluck_and_distinct + assert_equal [50, 53, 55, 60], Account.order(:credit_limit).distinct.pluck(:credit_limit) end def test_pluck_in_relation |