我有一个大问题,我有一个输入,我把我的金额格式化成这样.
15550.55,问题是,一旦我提交了这个值,它就会将其存储为15.50,因为BigDecimal对象,它不会取整数.
在我的参数中,我收到的值为"dr_business_remuneration"=>"15,550.55"
对于该属性,我的postgresql数据库中的数据类型是数字(19,2)
我唯一想要的是,一旦提交,值将存储为15550.55,但在我的视图中显示为15550.55.
我在我的模型中try 了一个带有before_save回调的方法,该方法在保存该值之前擦除我的"".
before_save: montos_formateados
def montos_formateados
if !self.dr_business_remuneration.blank?
self.dr_business_remuneration.sub(",", "").to_f
end
end
但返回此错误.
no implicit conversion of String into Integer