Is there a way to have rails print out a number with commas in it?
For example, if I have a number 54000000.34, I can run <%= number.function %>, which would prin
If you're doing it a lot but also FYI because it's not implied by the above, Rails has sensible defaults for the number_with_delimiter
method.
#inside controller or view
number_with_delimiter(2444323.4)
#=> 2,444,323.30
#inside console
helper.number_with_delimiter(233423)
#=> 233,423
No need to supply the delimiter value if you're doing it the most typical way.