Created
June 29, 2011 19:55
-
-
Save hosh/1054766 to your computer and use it in GitHub Desktop.
Group By Helper
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
# Ugly hack until PostgreSQL 9.1 comes out. | |
module Models | |
module GroupByHelper | |
extend ActiveSupport::Concern | |
included do | |
scope :group_by_all, lambda { group(self.column_names.map { |c| "#{self.table_name}.#{c}" }.join(',')) } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment