Hello,
I have the following:
validates :fname, :presence => true, :length => { :minimum =>
2 }
How do I add a message to that? Right now the errors says “Fname is
too short (minimum is 2 characters)” I’d like it to say First Name and
not Fname.
Thanks.
On Nov 10, 11:35am, CuriousNewbie [email protected] wrote:
Hello,
I have the following:
validates :fname, :presence => true, :length => { :minimum =>
2 }
How do I add a message to that? Right now the errors says “Fname is
too short (minimum is 2 characters)” I’d like it to say First Name and
not Fname.
You can simply change the name of the field in your locale file:
en:
activerecord:
attributes:
user:
fname: First name
Check out the Rails Internationalization Guide for more info:
that is awesome . thank you!
Or, by doing a search of the forum, you’d find my question of the same
subject recently:
http://www.ruby-forum.com/topic/217956#new
short answer:
validates :name, :presence => { :message => “an alternate message” }