PATCH: #11502, double DISTINCT in generated SQL for Model.count

Hi all

Found a fringe case bug and made a patch:

When calling #count on a model and passing a :select value with
DISTINCT in, and eager loading an association, ActiveRecord blindly
adds another DISTINCT to the COUNT parameter.

Example (based on ActiveRecord test cases)

Account.count( :select => 'DISTINCT', :include => :firm )

Produces the following invalid SQL

count_distinct_accounts_id FROM `accounts` LEFT OUTER JOIN
`companies` ON `companies`.id = `accounts`.firm_id AND
`companies`.`type` = 'Firm'

The fix is trivial, and all tests pass in the same fashion as before
the patch. Hope its accepted quickly...

This was tested with MySQL, discovered by chance while debugging the
paginated_finder plugin.

Kind regards