title: Rails scope for values only between two dates
body: <p>I like to have a scope in Rails for selecting only values between two dates.</p>
  
  <p>Here is my example:</p>
  
  <p>I have a model with the attribute '<em>startDate</em>' and '<em>endDate</em>'. Both have the type '<em>date</em>' </p>
  
  <p>Now I want to select every entry from today, which is between these two dates.</p>
  
  <p>I made a scope looks like this.</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
    scope :activeDate, -&gt; { where("? &gt;= ? AND ? &lt;= ?", Time.now.to_date, :saleStartDate, Time.now.to_date, :salesEndDate)}
  </code></pre>
  
  <p>In the controller:</p>
  
  <pre><code>@products = Product.activeDate
  </code></pre>
  
  <p>Unfortunately it does not work. Is there a rails-way (more beautiful) to get all entries?</p>
  
  <p>Thanks a lot.</p>