I'm usually using number_with_delimiter
to make my integer or my decimal more easy to read, I have once problem with it when using it inside controller but it solved that time. Now I don't know what happen actually when I just simply put those function on my view
it return integer
without delimiter
.
Please see this simulation I create to show the different.
<td><%= number_to_currency(stock.qty) %></td>
<td><%= (number_with_delimiter number_with_precision stock.qty, :precision => 2) %></td>
<td><%= number_with_delimiter(stock.qty) %></td>
<td><%= stock.qty %></td>
Result:
$100,070.00 100070 100070 100070.0
So the number_with_delimiter
and number_with_precision
isn't working also. The thing also is it just happen to this project while the others projects on my local all doing fine. And also on my other branch of this project also fine. So I know that there is something I broke into. But I don't know which one it is, since I also didn't realize and didn't know which one I make it broken, I can't trace through my version control cause there is too much update on it. Please any help. Thank you so much.
Thanks to @tomanow that lead me to the expected result. So in the end I used there code:
Located on my application_helper.rb
def delimiter(number)
number_with_delimiter(number, :delimiter => ",", :separator => ".")
end
And use it everywhere. Thanks