Anyone have a quick solution on how to format a number in a text_field tag? <% text_field "price", "amount" %> returns 100.0 and it would be nice if it showed 100.00 Of course, number_with_precision works nicely, but how do you make that work with text_field? I thought maybe overriding the getter in the model. However, this means I would have to bring the helper code into the model which I'm not sure I like. Brian Hogan Web Development Learning & Technology Services Schofield 3-B University of Wisconsin-Eau Claire 715 836 3585 email@example.com
on 2006-02-24 18:09
on 2006-02-26 12:35
on 2006-02-26 12:47
Hogan, Brian P. wrote: > I like. Yes, overriding the attribute getter and setter is what I do: def amount_s '%.2f' % amount end def amount_s= (amount) self.amount = amount.to_f end <%= text_field :price, :amount_s %> -- We develop, watch us RoR, in numbers too big to ignore.