rails/rails — pull request #3507 by jmazzi (2011-11-04 01:19:29+00:00)
Title: Preserve SELECT columns on the COUNT for finder_sql when possible

Squashed into one commit for pull request #3503

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 '*'.