title: Query 'any' value with 'where' in Rails
body: <p>I have the following method:</p>
  
  <pre><code>def self.fetch_by_subcat(subcat_id, state)
    where(state: state).joins(:subcategories).where("subcategory_id = ? AND published = ?", subcat_id, true)
  end 
  </code></pre>
  
  <p>The problem is that if my state is blank, I get back an empty array. So I would like to set my state argument to a default, something like 'any', which will simply skip the where(state ...) query and go straight to joins. So something like</p>
  
  <pre><code>def self.fetch_by_subcat(subcat_id, state='any')
    where(state: state).joins...
  end 
  </code></pre>
  
  <p>Is there a way? Trying to avoid if/else. </p>