title: Rails 3 multiple parameter filtering using scopes
body: <p>Trying to do a basic filter in rails 3 using the url params. I'd like to have a white list of params that can be filtered by, and return all the items that match. I've set up some scopes (with many more to come):</p>
  
  <pre><code># in the model:
  scope :budget_min, lambda {|min| where("budget &gt; ?", min)}
  scope :budget_max, lambda {|max| where("budget &lt; ?", max)}
  </code></pre>
  
  <p>...but what's the best way to use <strong>some, none, or all</strong> of these scopes based on the present <code>params[]</code>? I've gotten this far, but it doesn't extend to multiple options. Looking for a sort of "chain if present" type operation.</p>
  
  <pre><code>@jobs = Job.all
  @jobs = Job.budget_min(params[:budget_min]) if params[:budget_min]
  </code></pre>