Trying to retrieve an array of ActiveRecord Objects grouped by date with PostgreSQL.
More specifically I\'m trying to translate the following MySQL query:
My solution:
def self.columns_list column_names.collect { |c| "#{table_name}.#{c}" }.join(",") end scope :selling, joins(:products).group(columns_list)
Simple and repeatable.