And how can I remove the trailing zeros if the value is to be shown in a text field?
I.e.: <%= linea_form.text_field :unidades, :id => "invoice_line_units", :name => "invoice[lines_attributes][#{id_or_index}][units]", :size => 10 %> Matt Jones wrote: > The %g specifier to sprintf will do this automatically: > > "%g" % 1.0 > => "1" > > "%g" % 1.375 > => "1.375" > > --Matt Jones -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.