title: Dynamic ActiveRecord finder methods chaining based on params
body: <p>Im new to rails and I want to make a select query based on diffrent GET params (filtering and sorting). Can I some how add conditions to find in the code? </p>
  
  <p>For example:</p>
  
  <pre><code>if params[:ratings] 
    Movie.where(:rating =&gt; params[:ratings].keys)
  end
  </code></pre>
  
  <p>and then add ordering and other where conditions. How can I achive this? Maybe there is a better way to dybamicly modify select query (without making SQL string). 
  Thanks.</p>