title: How can I search a table based on multiple search criteria without require said criteria?
body: <p>I have created a table that houses product brochures.  I would like to allow the user to search the table based on three drop down menus (product type, carrier, concept).  I have created the menus and the controller currently passes through the params correctly.  If the user search by all 3 criteria, the search displays correctly.  If the user chooses only one or two search options however, the result is always nothing.  I understand why this is happening (the model is trying to search by all three criteria and when one is missing, it simply searches nil in that field), however I'm sure the correct solution.  Please help!  My model is below...thank you</p>
  
  <pre><code>def self.search (search_product_type, search_carrier, search_concept)
  
    if search_product_type.blank? &amp;&amp; search_carrier.blank? &amp;&amp; search_concept.blank?
      scoped
    else
      Ad.where(carrier_id: search_carrier)
        .where(product_type_id: search_product_type)
        .where(concept: search_concept)
    end
  end
  </code></pre>