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. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 10, 11:35 am, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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: http://guides.rubyonrails.org/i18n.html -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
that is awesome . thank you! On Nov 10, 8:50 am, Tim Shaffer <timshaf...-BUHhN+a2lJ4@public.gmane.org> wrote:> On Nov 10, 11:35 am, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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:http://guides.rubyonrails.org/i18n.html-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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" } -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.