title: How can i interpolate ivars into Rails i18n strings during validation?
body: <p>Suppose I have a model class like this:</p>
  
  <pre><code>class Shoebox &lt; ActiveRecord::Base
    validates_inclusion_of :description, :in =&gt; ["small", "medium"],
      :message =&gt; I18n.t("activerecord.errors.models.shoebox.with_name",
                       :name =&gt; name)
  end
  </code></pre>
  
  <p>And some yaml:</p>
  
  <pre><code>en:
   activerecord:
    errors:
     models:
      shoebox:
       with_name: "the description of %{name} is not in the approved list"
  </code></pre>
  
  <p>And I create a new Shoebox:</p>
  
  <pre><code>   s = Shoebox.new(:description =&gt; "large", :name =&gt; "Bob")
     s.valid?
  </code></pre>
  
  <p>But when I look at the error (s.errors.first.message), I see:</p>
  
  <blockquote>
    <p>"the description of Shoebox is not in
    the approved list"</p>
  </blockquote>
  
  <p>and not:</p>
  
  <blockquote>
    <p>"the description of Bob is not in the
    approved list"</p>
  </blockquote>
  
  <p>I've tried <code>:name =&gt; name</code>, <code>:name =&gt; :name</code>, <code>:name =&gt; lambda{name}</code>, <code>:name =&gt; lambda{:name}</code>.</p>
  
  <p>I've tried creating a helper method</p>
  
  <pre><code> def shoebox_name
     name
   end
  </code></pre>
  
  <p>And passing <code>:name =&gt; shoebox_name</code>, <code>:name =&gt; :shoebox_name</code>, <code>:name =&gt; lambda{shoebox_name}</code> and <code>:name =&gt; lambda {:shoebox_name}</code>.</p>
  
  <p>How can I get the ivar value for name to be interpolated into the string?</p>