Module: Squeel::Adapters::ActiveRecord::RelationExtensions

Defined in:
lib/rocket_tag/taggable.rb

Instance Method Summary collapse

Instance Method Details

#group_by_all_columnsObject

We really only want to group on id for practical purposes but POSTGRES requires that a group by outputs all the column names not under an aggregate function.

This little helper generates such a group by



12
13
14
15
# File 'lib/rocket_tag/taggable.rb', line 12

def group_by_all_columns
  cn = self.column_names
  group { cn.map { |col| __send__(col) } }
end