rails/rails — pull request #3503 by jmazzi (2011-11-03 19:24:23+00:00)
Title: Preserve SELECT columns on the COUNT for finder_sql when possible

I realize that not all custom_counter_sql can be inferred from the finder_sql which is why they currently default to COUNT(*). This patch will pass the columns used for "simple" SELECT to COUNT. If the SELECT contains any commas it will fallback to using '*'.