How do I override generic activerecord error messages in ruby-on-rails?

Posted by David Smith on Stack Overflow See other posts from Stack Overflow or by David Smith
Published on 2010-03-22T15:02:52Z Indexed on 2010/03/22 15:51 UTC
Read the original article Hit count: 356

Filed under:
|

In my en.yml translation file, I have:

activerecord:
  errors: 
    template: 
       header: 
         one: "1 error prohibited this {{model}} from being saved"
         other: "{{count}} errors prohibited this {{model}} from being saved"  

When an activerecord/validation error occurs during logging into my application, the error message:

"1 error prohibited this user session from being saved"

is displayed (where user_session is the model being used). I'd rather have it say something like

"An error has occured to prevent you from logging into your account".

How do I override the generic error message with my specific one?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about i18n