Commit 3888059893ce99f55b69727b4ae39629f0d3633f

Authored by Andrew
1 parent 15bbb837

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,7 +113,12 @@ module Searchkick
113 obj.to_f 113 obj.to_f
114 when Hash 114 when Hash
115 obj.each do |k, v| 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 end 122 end
118 when Enumerable 123 when Enumerable
119 obj.map do |v| 124 obj.map do |v|