aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/counter_cache.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-01-09 21:08:04 +0900
committerJeremy Daer <jeremydaer@gmail.com>2017-02-25 19:10:33 -0700
commitd38e5d2719ad8f236d3bd30c60a113d8087db43e (patch)
tree35b4adda7486c32f9a3206bd1069740c31736496 /activerecord/lib/active_record/counter_cache.rb
parent558336ee2afad116077df07b5b963077ac5f5021 (diff)
downloadrails-d38e5d2719ad8f236d3bd30c60a113d8087db43e.tar.gz
rails-d38e5d2719ad8f236d3bd30c60a113d8087db43e.tar.bz2
rails-d38e5d2719ad8f236d3bd30c60a113d8087db43e.zip
Suppress `DISTINCT` clause outside aggregate function
`DISTINCT` clause is applied inside aggregate function by `operation_over_aggregate_column` if needed. Unneeded outside aggregate function. ```ruby # Before author.unique_categorized_posts.count # => SELECT DISTINCT COUNT(DISTINCT "posts"."id") FROM "posts" INNER JOIN "categorizations" ON "posts"."id" = "categorizations"."post_id" WHERE "categorizations"."author_id" = ? [["author_id", 2]] # After author.unique_categorized_posts.count # => SELECT COUNT(DISTINCT "posts"."id") FROM "posts" INNER JOIN "categorizations" ON "posts"."id" = "categorizations"."post_id" WHERE "categorizations"."author_id" = ? [["author_id", 2]] ``` Closes #27615
Diffstat (limited to 'activerecord/lib/active_record/counter_cache.rb')
0 files changed, 0 insertions, 0 deletions