From cd87c85ef05e47f6ea1ce7422ae033fe6d82b030 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Tue, 12 Mar 2013 10:52:25 +0100 Subject: 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. --- activerecord/CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 37be191e0c..6affb2aada 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,18 @@ ## Rails 4.0.0 (unreleased) ## +* The `:distinct` option for `Relation#count` is deprecated. You + should use `Relation#distinct` instead. + + Example: + + # Before + Post.select(:author_name).count(distinct: true) + + # After + Post.select(:author_name).distinct.count + + *Yves Senn* + * Rename `Relation#uniq` to `Relation#distinct`. `#uniq` is still available as an alias but we encourage to use `#distinct` instead. Also `Relation#uniq_value` is aliased to `Relation#distinct_value`, -- cgit v1.2.3