0

yml

en   
  activerecord:
    errors: 
      models: 
        user:
          confirmation: "Passwords do not match"

but I get

"Password Passwords do not match"

how can i get rid of "Password"?

2 Answers2

5

Try this:

# config/locales/en.yml
en:
  activerecord:
    attributes:
      user:
        password_confirmation: "Passwords"
    errors:
      models:
        user:
          attributes:
            password_confirmation:
              confirmation: " do not match!"
Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85
  • that will also likely change the label for the field to read 'Passwords', depending on how the form was generated. Either way, it's not the right approach. – sevenseacat Apr 24 '14 at 08:58
3

The best I can give is to remove the attribute from the error message (so you only get the message) - removing field name from validation error message

This is what we use in Rails 4.0.2:

<% resource.errors.each do |attr,msg| %>
    <li><%= msg %></li>
<% end %>
Community
  • 1
  • 1
Richard Peck
  • 76,116
  • 9
  • 93
  • 147