Created
June 23, 2009 12:33
-
-
Save beef/134510 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::Base | |
protected | |
def self.construct_count_options_from_args(*args) | |
name_and_options = super | |
if name_and_options[0].is_a?(String) | |
if name_and_options[0].include?(',') | |
name_and_options[0] = "DISTINCT #{quoted_table_name}.#{primary_key}" | |
elsif name_and_options[0] =~ /\.\*$/ | |
name_and_options[0] = '*' | |
end | |
end | |
name_and_options | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment