Common Formatting Helpers

Adding  a list of some of the Rails formatting helpers I often have to use:

  • Converting a number to a dollar amount -> number_to_currency(field_value)
  • Changing the date to US date format (MM/DD/YYYY) -> field_value.strftime(“%m/%d/%Y”)
  • Converting to a percentage -> number_to_percentage(field_value)

For additional helpers with numbers here’s the link to the Rails API for number helpers