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

-- 
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.

Reply via email to