I'm using Rails and wanted to convert a float to currency. I'm using number_to_currency
in a Sidekiq Worker, so I've added include ActionView::Helpers::NumberHelper
in the file and where I want the conversion I've added the following:
number_to_currency(value, unit: '', delimeter: '.', separator: ',')
And I wanted the result something like: 1.200,09
but its not working. An example of values I have and want to convert is: 1001.4290000000004
which should be converted to 1.001,43
. I've also tried:
number_to_currency(final_total, unit: '', delimeter: ',', separator: '.')
And still doesn't work. I'm getting is 1,200.09
. I'm using Rails 4.2.x
What am I missing here?
You just have a typo in word delimiter
. It should be as follows:
number_to_currency(value, unit: '', delimiter: '.', separator: ',')