From 2181832fca6171631f6c7ff700e14676c6d331e8 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 1 Jul 2013 22:11:20 +0200 Subject: Remove deprecated `:distinct` option from `Relation#count`. --- activerecord/CHANGELOG.md | 4 ++++ activerecord/lib/active_record/relation/calculations.rb | 5 ----- activerecord/test/cases/calculations_test.rb | 10 ---------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 2b0195c5b6..abc134b11c 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Remove deprecated `:distinct` option from `Relation#count`. + + *Yves Senn* + * Removed deprecated methods `partial_updates`, `partial_updates?` and `partial_updates=`. diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index f2d28db923..68968e42a5 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -194,11 +194,6 @@ module ActiveRecord # If #count is used with #distinct / #uniq it is considered distinct. (eg. relation.distinct.count) distinct = self.distinct_value - if options.has_key?(:distinct) - ActiveSupport::Deprecation.warn "The :distinct option for `Relation#count` is deprecated. " \ - "Please use `Relation#distinct` instead. (eg. `relation.distinct.count`)" - distinct = options[:distinct] - end if operation == "count" if select_values.present? diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 0f3f9aecfc..73a183f9b4 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -351,16 +351,6 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal 5, Account.count(:firm_id) end - def test_count_distinct_option_is_deprecated - assert_deprecated do - assert_equal 4, Account.select(:credit_limit).count(distinct: true) - end - - assert_deprecated do - assert_equal 6, Account.select(:credit_limit).count(distinct: false) - end - end - def test_count_with_distinct assert_equal 4, Account.select(:credit_limit).distinct.count assert_equal 4, Account.select(:credit_limit).uniq.count -- cgit v1.2.3