Hash keys Mar 28, 2018 | ruby Didn’t know hash keys could be arrays. Zang! EnergyRecord.includes(:case) .by_date(Time.now.strftime('%F')) .group('cases.case_id', 'HOUR(energy_records.created_at)') .maximum(:kwh) # {["C341", 0]=>1185, ["C341", 1]=>2135, ["C341", 2]=>3220, ...} # _[["C341", 0]] # 1185