Follow Along as I Stumble on the Path to Learning RoR

Posts tagged “format

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

Advertisements

Formatting Date Display in Rails

I needed help in formatting time in Rails and found here in the strftime( string ) → string section.  In particular, I wanted to change the default timestamp (created_at) to an American format MM/DD/YYYY.

http://www.ruby-doc.org/core-1.9.3/Time.html#M000297

 


jqGrid

resources for using jqgrid with Rails
http://www.2dconcept.com/jquery-grid-rails-plugin

 

 

formatters available for jqgrid (use to format the data showing in jqgrid)
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:predefined_formatter


US Date Format

My dates were displaying DD-MM-YYYY, but I wanted to display it MM/DD/YYYY.

Here’s an easy way to do that.

http://www.spritle.com/blogs/?p=174