Created
July 14, 2011 20:27
-
-
Save balexand/1083358 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# when I call Thing.count, it works and DISTINCT records are selected | |
# when I call Thing.scoped.count (or any other query), it doesn't work | |
class Thing < ActiveRecord::Base | |
class << self | |
def count_with_distinct | |
count_without_distinct(:distinct => true) | |
end | |
alias_method_chain :count, :distinct | |
end | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment