Hi all Found a fringe case bug and made a patch: http://dev.rubyonrails.org/ticket/11502
<ticket_snippet> 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 accounts.id', :include => :firm ) Produces the following invalid SQL SELECT count(DISTINCT DISTINCT accounts.id) AS 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. </ticket_snippet> Kind regards -- Kenneth Kalmer [EMAIL PROTECTED] [EMAIL PROTECTED] stats http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=kenneth%2Ekalmer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
