I have a form that updates 3 models. To the end user its just a form and they don't need to know what is happening behind the scenes. My problem is that the error_messages_for prefixes errors on associations with their name. I have a user model that has many addresses. When a user is signing up errors on address fields show up as
Addresses first name can't be blank
I would rather if it just said
=> First name can't be blank
Now I can get this if I do the following
=> error_messages_for 'user', :object => [@user.addresses]
but then I don't get errors on the user object like
=> Password can't be blank
Is there a way to tell the user object to drop errors it has on its associations so I can do the following
=> error_messages_for 'user', :object => [@user, @user.addresses]
At the moment it will result in the first name being flagged twice. # Addresses first name can't be blank # Password can't be blank # First name can't be blank