title: How to pass the value of column to the custom error message of validates
body: <p>I have a model with 2 column, <code>name</code> and <code>answer</code></p>
  
  <p>How can I pass the value of <code>name</code> to the custom error message of validates of a model.</p>
  
  <p><em>sample code:</em></p>
  
  <pre><code>#app/models/sample_model.rb
  Class SampleModel &lt; ActiveRecord::Base
      validates :answer, 
                  :presence =&gt; {:message =&gt; "Error name: #{self.name}"}
  end
  </code></pre>
  
  <p>Instead of the value of column <code>name</code>, it shows the name of the model which is <strong>SampleModel</strong>.</p>