Ruby Rails: wont save as decimal in postgresql -
im using ruby 2.4.1 rails 5.0.2
here code:
total_price = 600.0 o = client.bills.new(client_id: client, total_price: total_price.to_f) #<bill id: nil, client_id: 21, created_at: nil, updated_at: nil, total_price: 0.6e3, bill_id: nil, discount_price: nil> o.save
it save 0.00
instead of 600.0
or 0.6e3
in postgresql. oh, im using numeric(8,2) datatypes decimal, :precision => 8, :scale => 2
my migration:
add_column :bills, :total_price, :decimal, :precision => 8, :scale => 2
any clues?
i think have validation/callback preventing correct value written database. double check validations/callbacks in bill
model.
Comments
Post a Comment