On May 21, 2007, at 7:58 AM, ruby wrote:
>
> Hi there,
>
> I have been facing problem in displaying the value of the column
> which
> is of type float. by default it displays only single digit after
> decimal
> point so how can I set the precision while displaying the value of the
> field in the rhtml file
>
> thanking you
You need to format it yourself as in:
<%= ''%.2f'' % [your_value] %>
Compare:
>> ''%.2f'' % [4.5]
=> "4.50"
>> 4.5.to_s
=> "4.5"
-Rob
Rob Biedenharn http://agileconsultingllc.com
Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---