title: How to select IN array of strings using where clause
body: <p>I am trying to search using an array of strings in my where clause.</p>
  
  <p>The array is generated by splitting the string contained within <em>param[:q][:genres_name_cont]</em> like this:</p>
  
  <pre><code>params[:q][:genrearray] = params[:q][:genres_name_cont].split
  </code></pre>
  
  <p>For example, if 'Rock Blues' is entered in the genre field, <em>params[:q][:genrearray] = ["Rock", "Blues"]</em>.</p>
  
  <p>Giving me the array which I then use in my where clause:</p>
  
  <pre><code>@bands = Band.joins(:genres).where("genres.name IN (?)", params[:q][:genrearray])
  </code></pre>
  
  <p>However, the SQL generated doesn't seem to be searching through an array like I would expect:</p>
  
  <pre><code>SELECT DISTINCT "bands".* FROM "bands" LEFT OUTER JOIN "bands_genres" ON "bands_genres"."band_id" = "bands"."id" LEFT OUTER JOIN "genres" ON "genres"."id" = "bands_genres"."genre_id" WHERE "genres"."name" ILIKE '%Rock Blues%'
  </code></pre>
  
  <p>Rather than ' <em>ILIKE '%Rock Blues%'</em>' I would be expecting to see something like ' <em>IN ('Rock','Blues')</em>'</p>
  
  <p>Thanks in advance to anyone who can help.</p>