title: Is it possible to send an SQL query condition as an argument to a function in RoR?
body: <pre><code>condition = "status = #{val} OR quality = #{other_val}"
  
  def func(condition)
     Table.where(condition).other_queries
  end
  </code></pre>
  
  <p>I need this function because other_queries is used commonly and I don't want to repeat code.</p>
  
  <p>The problem is that when <code>val</code> or <code>other_val</code> is empty, I get an invalid SQL error. The query string basically looks like  <code>"status = OR quality = 4"</code></p>
  
  <p>What do I do in this case?</p>