Questions tagged [number-to-currency]
18 questions
0
votes
1 answer
number_to_currency Removing the Decimal Point
Is there any way to change the value in the display to the following:
$100.25 to 10025
Need this to be in this format to go through a payment gateway.

Clay
- 149
- 3
- 11
0
votes
0 answers
number_with_precision return Integer
I have a very weird problem with number_with_precision() and number_to_currency().
In my application, they both raise an comparison of String with 0 failed if i do not set :precision
But when i try the very same functions in irb, everything is fineā¦

AkyRhO
- 187
- 2
- 11
-2
votes
2 answers
How to convert an integer to currency and display the correct cents
If @service.amount is equal to $28.95:
<%= number_to_currency(@service.amount) %>
is outputting $2895.00, not what I wrote above. After searching, I didn't find a solution. @service.amount is an integer because Stripe only accepts integers.
Grasshopper27
- 113
- 1
- 11