rails/rails — pull request #6970 by frodsan (2012-07-05 05:58:35+00:00)
Title: fix calculation for a relation with multiple selected columns

Before this patch, `count` returns an incorrect result when is
executed with multiple columns:

User.select('distinct username, email').count
# => SELECT count(*) FROM "users"

User.select('distinct users.*').count
# => SELECT count(*) FROM "users"

It proposes to raise an ActiveRecordError instead.

>> User.select('distinct username, email').count
# => ActiveRecord::ActiveRecordError: calculation of multiple columns is not
# supported

>> User.select('distinct users.*').count
# => ActiveRecord::ActiveRecordError: calculation of multiple columns is not
# supported

Fixes #5554.