You'll have to separate you attributes: validates_presence_of :name, :message => "Your name error here" validates_presence_of :email, :message => "Your e-mail error here"
On May 20, 3:32 pm, Marcelo <marcel...@gmail.com> wrote: > When i do this: > > validates_presence_of :name, :email, :message => "Can't be blank" > > and use the "error_message_on" method in my view, i get the same > message for both "name" and "email" fields - Can't be blank. > > How do i specify a different message for each attribute without having > to write a custom validation message? > > Passing a hash to the :message parameter would be great but it doesn't > work: > > validates_presence_of :name, :email, :message =>{:name => 'name > message', :email => 'email message'} > > Any thoughts? > > -- > 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-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.