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
The direct way to do this, with or without Rails, is:
require 'active_support/core_ext/numeric/conversions' 12345.to_s(:delimited) # => "12,345" 12345.6789.to_s(:delimited) # => "12,345.6789"
For more options, see Active Support Core Extensions - Numeric - Formatting.