Sha256: fa3279df52bc82f8e917afa66c7d4c0a447851e28667efa4e3413dbe8f501f0a
Contents?: true
Size: 472 Bytes
Versions: 13
Compression:
Stored size: 472 Bytes
Contents
module ActiveHouse module Groupable extend ActiveSupport::Concern included do private def build_group_by_query_part "GROUP BY #{@grouping.join(', ')}" unless @grouping.empty? end end def initialize(*) @grouping = [] super end def group_by(*fields) raise ArgumentError, 'wrong number of arguments' if fields.empty? chain_query grouping: (@grouping + fields.map(&:to_s)).uniq end end end
Version data entries
13 entries across 13 versions & 1 rubygems