title: Default scope ignoring dynamic value in condition
body: <p>In my Activity model, I have a default scope:</p>
  
  <pre><code>default_scope where(:subject_id =&gt; Log.get_subject_id)
  </code></pre>
  
  <p>Problem is in Log.get_subject_id, default value is 0. Here is my Log model:</p>
  
  <pre><code>@@subject_id = 0
  def self.set_subject_id(val)
    @@subject_id = val
  end
  def self.get_subject_id
    @@subject_id
  end
  </code></pre>
  
  <p>When I change value of @@subject_id via Log.set_subject_id(10) in controller and then I try Activity.all, it always give me bad result. SQL:</p>
  
  <pre><code>SELECT "activities".* FROM "activities" WHERE "activities"."subject_id" = 0
  </code></pre>
  
  <p>Where is a problem? Thanks!</p>