https://github.com/rails/rails/pull/9683#issuecomment-22827535
when distinct is intended as a parameter of the sql count function (COUNT(DISTINCT DATE(attr))), it makes perfect sense for it to be a parameter to the count method, particularly when you are counting expressions.
When counting just records (*) and count takes no arguments, .distinct.count
reads ok, but when there’s an expression involved .count('date(attr)')
, distinct and the count expression belong together as arguments to count .count('date(attr)', distinct: true)
, as in SQL COUNT(DISTINCT DATE(attr)
I think counting with expressions is sufficient reason for :distinct param to remain.