numbers
The NumberHelper in Rails

Formatting numbers can be a pain in the arse so the Rails team is nice and provides you with NumberHelper (more at http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html) which takes care of formatting numbers as currencies and much more.
To turn 299.9 into €299.99, simple do that:
<%= number_to_currency(’299.9′, :unit => “&euro;”) %>
And here we go
You can also set the [...]

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks
Read More
Posted on 30th October 2009No Comments