Skip to content

Commit

Permalink
Fix precision in money input
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgoll committed Nov 11, 2024
1 parent 3ef67fa commit 31ecd3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/views/shared/_money_field.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
value: if options[:value]
sprintf("%.#{currency.default_precision}f", options[:value])
elsif form.object && form.object.respond_to?(amount_method)
form.object.public_send(amount_method)
val = form.object.public_send(amount_method)
sprintf("%.#{currency.default_precision}f", val) if val.present?
end,
min: options[:min] || -99999999999999,
max: options[:max] || 99999999999999,
Expand Down

0 comments on commit 31ecd3c

Please sign in to comment.