Search
Categories
- Deployment (4)
- Development (63)
- Gems and Plugins (4)
- News (2)
- Projects (4)
- Testing (3)
Most Popular Tags
activerecord architecture collections css database date and time debugging design design patterns DRY ebooks fixtures floating-point numbers formatting framework front page global variables helpers I18n introductory launchpad meta-information migrations model multiplicity mvc MySQL partials production rails 2.0 rails 2.1 Rails 2.2 regular expressions routing rss ruby security setup sql UI upgrading user management validation xml xml builder
Tag Archives: formatting
Formatting Decimals
How can you format decimal-point (floating-point) numbers to a specific precision? Ruby has a sprintf function that allows you to do this. It takes a number and a string of a specific format, and returns the number rounded to the precision you specified. Continue reading
Created_On and Updated_On
Rails allows two special fields, created_on and updated_on, that it updates automatically. It tracks when model objects are created and updated. All you need to do is create the fields; Rails populates the values. Since these fields are useful, you can format them, to display them any way you please! Continue reading