Sfdesigner Sfdesigner
2006-Jul-27 21:31 UTC
[Rails] Form entries with decimals generating float errors
I have "time estimated" and a "time spent" fields in my task form. In my tasks table I have the "time_estimated" and "time_spent" rows assigned as float types. I''ve also tried setting them to decimal (4,2) with no luck. When I submit the form the error reads "NoMethodError in TasksController#create" then "Undefined method `size'' for 1.5:Float". The 1.5 is what I entered as a test in a form field declared with <%= text_field ''task'', ''hours_estimated'', :size => 7 %> Can anyone point me in the right direction? Thanks, DAN -- Posted via http://www.ruby-forum.com/.
Sfdesigner Sfdesigner
2006-Jul-28 03:26 UTC
[Rails] Re: Form entries with decimals generating float errors
I think I''m just gonna use varchar for now and then to_f in my list and show views. At least validates_numericality_of doesn''t complain. Not sure how else to handle non-currency decimal entries. DAN -- Posted via http://www.ruby-forum.com/.