title: how generate LIKE on arrays of values in where clause of sql query with rails?
body: <p>I have an array of value :</p>
  
  <pre><code>words = ['foo', 'bar', 'baz']
  </code></pre>
  
  <p>I want autogenerate a where clause with LIKE (and not "IN").</p>
  
  <p>What I do for now :</p>
  
  <pre><code>words = params[:content].split(' ').map { |w| "%#{w.strip}%" }
  
  where = []
  words.size.times do
    where &lt;&lt; 'name LIKE ?'
  end
  
  tags = Tag.where(where.join(' OR '), *words)
  </code></pre>
  
  <p>the correct request SQL is generate : </p>
  
  <pre><code>SELECT `tags`.* FROM `tags` WHERE (name LIKE '%foo%' OR name LIKE '%bar%' OR name LIKE '%baz%')
  </code></pre>
  
  <p>but it's not realy nice way...</p>
  
  <p>when I want compare array values with equals, we can just do :</p>
  
  <pre><code> Tag.where(name: words)
  </code></pre>
  
  <p>There is a possibility to do same thing but not generate <code>IN</code>, but multiple <code>OR LIKE "%VALUE%"</code> ? How?</p>