Forum: Ruby on Rails formatting amount

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
814930584b65ac3f44aa3878ff9cdb69?d=identicon&s=25 Nara Hari (hariraj)
on 2006-06-08 23:33
Hi,

What is the best way to format amount in RoR?

e.g $12000.937 => $12,000.94

Thanks,
Hari
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-06-15 19:22
(Received via mailing list)
On Jun 8, 2006, at 5:33 PM, Nara Hari wrote:
> Hi,
>
> What is the best way to format amount in RoR?
>
> e.g $12000.937 => $12,000.94
>
> Thanks,
> Hari

You can grab the code from:  http://wiki.rubygarden.org/Ruby/page/
show/NumericFormat
and put it into your lib directory and add a require to your
environment.rb.


or just look at http://api.rubyonrails.org/classes/ActionView/Helpers/
NumberHelper.html#M000449


-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
This topic is locked and can not be replied to.