title: Unable to customize devise error message
body: <p>I'm using Devise 3.2.2 and I want to customize error messages for my custom devise registrations controller, as suggested <a href="https://stackoverflow.com/a/5839744/182048">here</a>. When passing in an already used email address, the (custom) controller code</p>
  
  <pre><code>if user.save
    render :json =&gt; user.as_json, :status =&gt; 201
  else
    warden.custom_failure!
    render :json =&gt; user.errors, :status =&gt; 422
  end
  </code></pre>
  
  <p>produces the following json</p>
  
  <pre><code>{"email":["has already been taken"]}
  </code></pre>
  
  <p>I'd like to have this error message read</p>
  
  <pre><code>{"messages": ["The email address has already been taken."]}
  </code></pre>
  
  <p>Unfortunately, I can't find the string "has already been taken" in the config/locales/en.yml-file (nor do I see it on <a href="https://github.com/plataformatec/devise/blob/master/config/locales/en.yml" rel="nofollow noreferrer">GitHub</a>). In other words, the suggested resolution is not directly applicable to the problem at hand. </p>
  
  <p>Where can I find the error message in question? Is there a clean way to produce a human readable array of error messages in my custom controller?</p>