Customizing Devise error messages in Rails 3?

You can configure the error messages in the locales file at: /config/locales/devise.en.yml

Which should have something like below code and which you can easily modify to your liking:

en:  
  errors:  
    messages:  
      not_found: "not found"  
      already_confirmed: "was already confirmed"  
      not_locked: "was not locked"  

  devise:  
    failure:  
      unauthenticated: 'You need to sign in or sign up before continuing.'  
      unconfirmed: 'You have to confirm your account before continuing.'  
      locked: 'Your account is locked.'  
      invalid: 'OH NOES! ERROR IN TEH EMAIL!'  
      invalid_token: 'Invalid authentication token.'  
      timeout: 'Your session expired, please sign in again to continue.'  
      inactive: 'Your account was not activated yet.'  
    sessions:  
      signed_in: 'Signed in successfully.'  
      signed_out: 'Signed out successfully.'  

For a more detailed explanation, check out this url (with screenshots). The Customizing Error Messages section, in the article.

Leave a Comment