[Rails] How to change the error message easy way
Neeraj Kumar
neeraj.jsr at gmail.com
Tue Aug 8 23:11:33 GMT 2006
validates_presence_of :fname
results in the error message
"Fname can't be blank".
What I want is "First Name can't be blank".
I could do this
def validate
errors.add_to_base("First Name can't be blank") if fname.blank?
end
I find this clunky and I have to put everyrhing in the validate method. Is
there an easy to get what I want.
I tried this also validates_presence_of :fname , :message => 'new message'
still retains the fname.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060808/1cb8f73b/attachment-0001.html
More information about the Rails
mailing list