title: Customizing Model Validation error messages alerts
body: <p>I'm trying to customize the error message alert that users see at the <strong>top of a form</strong> when they input data incorrectly.  The error message alert I'm trying to customize are for Model Attributes which are in a nested form.</p>
  
  <p>I've tried the solution <a href="http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models" rel="nofollow noreferrer">here</a> which says to edit the <code>config/locales/en.yml</code> file but this only changes the message not the name of the model &amp; attribute which are displayed before the error message.</p>
  
  <p>I've also tried what Billy's suggested in <a href="https://stackoverflow.com/a/15696077/1814446">his answer</a> bellow which has the same result. i.e.</p>
  
  <p><strong>1 error prohibited this hikingtrail from being saved:</strong><br>
      <strong>- Directions directions from 'My Custom Blank Error Message'</strong> </p>
  
  <p>Is there a way for me to display a more user friendly Model &amp; attribute name in my error message or remove them entirely from the error message?</p>
  
  <p>Here is what I have:</p>
  
  <h2>config/locales/en.yml</h2>
  
  <pre><code>    # Sample localization file for English. Add more files in this directory for other locales.
      # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
  en:  
    activerecord:
      models: 
        direction: "In the Getting There section"
      attributes:
        direction:
          directions_from: "From field"
      errors:
        full_messages:
        format: "%{message}"
        models:
          direction:
            attributes:
              directions_from:
                blank: "My Custom Blank Error Message"
  </code></pre>
  
  <h2>Model</h2>
  
  <pre><code>class Direction &lt; ActiveRecord::Base
    belongs_to :hikingtrail
  
    attr_accessible :directions_by, :directions_desc, :directions_from
  
    validates :directions_from, :presence =&gt; {message: "'My Custom Error Message'", :if =&gt; Proc.new { |a| a.directions_by? || a.directions_desc? } }
  
    validates :directions_by, :presence =&gt; {message: "'My Custom Error Message'", :if =&gt; Proc.new { |a| a.directions_from? || a.directions_desc? } }
  
    validates :directions_desc, :presence =&gt; {message: "'My Custom Error Message'", :if =&gt; Proc.new { |a| a.directions_from? || a.directions_by? } }
  end
  </code></pre>