Rails number_with_delimiter return integer without delimiter -
i'm using number_with_delimiter
make integer or decimal more easy read, have once problem when using inside controller solved time. don't know happen when put function on view
return integer
without delimiter
.
please see simulation create show 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 number_with_delimiter
, number_with_precision
isn't working also. thing happen project while others projects on local doing fine. , on other branch of project fine. know there broke into. don't know 1 is, since didn't realize , didn't know 1 make broken, can't trace through version control cause there update on it. please help. thank much.
thanks @tomanow lead me expected result. in end used there code:
located on application_helper.rb
def delimiter(number) number_with_delimiter(number, :delimiter => ",", :separator => ".") end
and use everywhere. thanks