title: Is it possible to have a scope with optional arguments?
body: <p>Is it possible to write a scope with optional arguments so that i can call the scope with and without arguments?</p>
  
  <p>Something like:</p>
  
  <pre><code>scope :with_optional_args,  lambda { |arg|
    where("table.name = ?", arg)
  }
  
  Model.with_optional_args('foo')
  Model.with_optional_args
  </code></pre>
  
  <p>I can check in the lambda block if an arg is given (like described by Unixmonkey) but on calling the scope without an argument i got an <code>ArgumentError: wrong number of arguments (0 for 1)</code></p>