Hi all, I have one numeric field "age" and it have two validation presence and numerical true. When i click submit without filling any value then i face error message is "is not number" ,but error message should be "is should be presence". How to set this message? Both the condition are satisfying. Did i have to configure en.yml ? Thanks Fahim
on 2013-01-16 05:42
on 2013-01-16 06:05
1. Why do you have two presence validators? 2. add allow_blank: true to the numerical validator. -- Dheeraj Kumar
on 2013-01-16 06:24
No, your not getting my question , actually i want presence and numeric validation on "Age" field. When i click submit without filling any value then i face error message is "is not number" ,but error message should be "is should be presence". How to set this message? Hope you understood issue.
on 2013-01-16 09:10
Try giving the following. validates :age, :numericality => true, :allow_nil => true This validation will not be invoked if the age is not present.
on 2013-01-16 09:50
Thanks It works... Best Regards Fahim On Wednesday, January 16, 2013 1:40:38 PM UTC+5:30, Ruby-Forum.com User
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.