lib/active_median/model.rb in active_median-0.2.5 vs lib/active_median/model.rb in active_median-0.2.6
- old
+ new
@@ -70,10 +70,10 @@
# typecast
rows = []
columns = result.columns
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_value, untyped_row[i]) : untyped_row[i] })
+ rows << (result.column_types.empty? ? untyped_row : columns.each_with_index.map { |c, i| untyped_row[i] && result.column_types[c] ? result.column_types[c].send(:cast_value, untyped_row[i]) : untyped_row[i] })
end
result =
if group_values.any?
Hash[rows.map { |r| [r.size == 2 ? r[0] : r[0..-2], r[-1]] }]