Adapt preferable to work with new BigDecimal version

BigDecimal raises exception if called with nil or empty values
This commit is contained in:
Luis Ramos
2020-12-12 18:50:57 +00:00
parent ca1a4db299
commit b76261c61c

View File

@@ -115,6 +115,7 @@ module Spree
when :password
value.to_s
when :decimal
value = 0 if value.blank?
BigDecimal(value.to_s).round(2, BigDecimal::ROUND_HALF_UP)
when :integer
value.to_i