lib/active_median/model.rb in active_median-0.2.0 vs lib/active_median/model.rb in active_median-0.2.1

- old
+ new

@@ -25,13 +25,18 @@ cast_method = ActiveRecord::VERSION::MAJOR < 5 ? :type_cast : :cast_value result.rows.each do |untyped_row| rows << (result.column_types.empty? ? untyped_row : columns.each_with_index.map { |c, i| untyped_row[i] ? result.column_types[c].send(cast_method, untyped_row[i]) : untyped_row[i] }) end - if group_values.any? - Hash[rows.map { |r| [r.size == 2 ? r[0] : r[0..-2], r[-1]] }] - else - rows[0] && rows[0][0] - end + result = + if group_values.any? + Hash[rows.map { |r| [r.size == 2 ? r[0] : r[0..-2], r[-1]] }] + else + rows[0] && rows[0][0] + end + + result = Groupdate.process_result(relation, result) if defined?(Groupdate.process_result) + + result end end end