title: ruby on rails scopes - ArgumentError: wrong number of arguments(1 for 0)
body: <p>I'm getting a wrong arguments error when invoking a scope:</p>
  
  <pre><code>Report.start_driver_time(Unit.find(3007),Driver.find(2),3,2013)
  
    scope :start_driver_time, lambda { |unit, driver, month, year|
      where("unit_id = ? AND
            driver_id = ? AND
            extract(MONTH FROM time) = ? AND
            extract(YEAR FROM time) = ?",
            unit.id, driver.id, month, year)
      .order("time asc")
      .min(:time)
    }
   #select(:time) select([:id, :time])
  
    scope :next_driver_time, lambda {|unit, time|
      joins(:alerts =&gt; {:alert_code =&gt; :alert_unit_codes})
      .where("reports.unit_id = ? AND
              reports.time &gt;= ? AND
              alert_unit_codes.name = ?",
              unit.id, time, "Seat Belt OFF")
      .min(:time)        
    }
  
    scope :reports_within_driving_period, lambda { |start_time, end_time|
      where("unit_id = ? AND
              reports.time &gt;= ? AND
              reports.time &lt;= ?",
              start_time, end_time)
    }
  </code></pre>
  
  <p>stacktrace:</p>
  
  <pre><code>ArgumentError: wrong number of arguments(1 for 0)
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation/delegation.rb:37:in `min'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation/delegation.rb:37:in `method_missing'
      from /Users/johnmerlino/Documents/github/XKTrackingSystem/app/models/report.rb:40:in `block in &lt;class:Report&gt;'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/named.rb:180:in `call'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/named.rb:180:in `block (2 levels) in scope'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/default.rb:41:in `block in unscoped'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation.rb:241:in `block in scoping'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping.rb:98:in `with_scope'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation.rb:241:in `scoping'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/default.rb:41:in `unscoped'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/named.rb:180:in `block in scope'
      from (irb):1
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.5/lib/rails/commands/console.rb:47:in `start'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.5/lib/rails/commands/console.rb:8:in `start'
      from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.5/lib/rails/commands.rb:41:in `&lt;top (required)&gt;'
      from script/rails:6:in `require'
      from script/rails:6:in `&lt;main&gt;'1.9.3p0 :002 &gt; exit
  </code></pre>