Easy custom validation messages on a per-attribute basis

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'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"