On 30 August 2010 21:17, Ithelp Eighty-five <[email protected]> wrote: > Colin Law wrote: >> On 30 August 2010 18:01, Ithelp Eighty-five <[email protected]> >> wrote: >>> Hello everyone I have a problem in my app with the validation on >>> numericality. The field should be all numbers, and if an user types for >>> example "12345abc" into the field an error is raised and the data is not >>> saved. But in the field where the error was raised it now says "12345", >>> I want this field to be blank instead. >> >> In the update and/or create action, after the failed save, just blank >> the field in the object being passed to the view. So if the object is >> @my_thing and the field is value then set @my_thing.value = "" or >> possibly nil might be better. >> >> Colin > > Where should this code go? In the Model, View, or controller?
After the failed save, which is in the update and/or create action of the controller. I think maybe the fact that you had to ask that question means you might benefit from working through the Rails Guides (google it). Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

