title: has_many :through with instance specific conditions
body: <p>Is it possible to set an instance-level constraint on a has_many, :through relationship in rails 3.1?</p>
  
  <p><a href="http://guides.rubyonrails.org/association_basics.html#the-has_many-association" rel="nofollow">http://guides.rubyonrails.org/association_basics.html#the-has_many-association</a></p>
  
  <p>Something like:</p>
  
  <pre><code>Class A
      has_many :c, :through =&gt; :b, :conditions =&gt; { "'c'.something_id" =&gt; @a.something_id }
  </code></pre>
  
  <p>The documentation gives me hope with this, but it doesn't work for me:</p>
  
  <blockquote>
    <p>If you need to evaluate conditions dynamically at runtime, you could
    use string interpolation in single quotes:</p>
  </blockquote>
  
  <pre><code>class Customer &lt; ActiveRecord::Base
    has_many :latest_orders, :class_name =&gt; "Order",
      :conditions =&gt; 'orders.created_at &gt; #{10.hours.ago.to_s(:db).inspect}'
  end
  </code></pre>
  
  <p>That gives me "unrecognized token '#'" on rails 3.1. Wondering if this functionality doesn't work anymore?</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>Want to clarify why I don't think scopes are the solution. I want to be able to get from an instance of A all of the Cs that have a condition (which is based on an attribute of that instance of A). These are the only Cs that should EVER be associated with that A. To do this with scopes, I would put a scope on C that takes an argument, and then have to call it from @a with some value? I don't get why that's better than incorporating it into my has_many query directly.</p>