diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-03-12 10:52:25 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-03-15 14:15:47 +0100 |
commit | cd87c85ef05e47f6ea1ce7422ae033fe6d82b030 (patch) | |
tree | d4a74669f3f5a9dd8900b688e4e00481c0a8b1e9 /activerecord/test/cases/relations_test.rb | |
parent | a1bb6c8b06db83546179175b9b2dde7912c86f9b (diff) | |
download | rails-cd87c85ef05e47f6ea1ce7422ae033fe6d82b030.tar.gz rails-cd87c85ef05e47f6ea1ce7422ae033fe6d82b030.tar.bz2 rails-cd87c85ef05e47f6ea1ce7422ae033fe6d82b030.zip |
Deprecate the `:distinct` option for `Relation#count`.
We moved more and more away from passing options to finder / calculation
methods. The `:distinct` option in `#count` was one of the remaining places.
Since we can now combine `Relation#distinct` with `Relation#count` the option
is no longer necessary and can be deprecated.
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 3de2c6ab58..db81ceeb52 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -790,11 +790,11 @@ class RelationTest < ActiveRecord::TestCase def test_count_with_distinct posts = Post.all - assert_equal 3, posts.count(:comments_count, :distinct => true) - assert_equal 11, posts.count(:comments_count, :distinct => false) + assert_equal 3, posts.distinct(true).count(:comments_count) + assert_equal 11, posts.distinct(false).count(:comments_count) - assert_equal 3, posts.select(:comments_count).count(:distinct => true) - assert_equal 11, posts.select(:comments_count).count(:distinct => false) + assert_equal 3, posts.distinct(true).select(:comments_count).count + assert_equal 11, posts.distinct(false).select(:comments_count).count end def test_count_explicit_columns |