Commit 3888059893ce99f55b69727b4ae39629f0d3633f
1 parent
15bbb837
Exists in
master
and in
19 other branches
Don't reassign unless have to [skip ci]
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
lib/searchkick/record_data.rb
... | ... | @@ -113,7 +113,12 @@ module Searchkick |
113 | 113 | obj.to_f |
114 | 114 | when Hash |
115 | 115 | obj.each do |k, v| |
116 | - obj[k] = cast_big_decimal(v) | |
116 | + # performance | |
117 | + if v.is_a?(BigDecimal) | |
118 | + obj[k] = v.to_f | |
119 | + elsif v.is_a?(Enumerable) || | |
120 | + obj[k] = cast_big_decimal(v) | |
121 | + end | |
117 | 122 | end |
118 | 123 | when Enumerable |
119 | 124 | obj.map do |v| | ... | ... |