title: Rails Query with ILIKE
body: <p>I have written a finder as follows:</p>
  
  <pre><code>@cars = @cars.joins(:manufacturers).where("manufacturers.name ILIKE ?", params[:manufacturer].gsub!(/-/, ' '))
  </code></pre>
  
  <p><code>params[:manufacturer]</code> comes through in a form of a string that has been <code>.parameterize</code>d by Rails.</p>
  
  <p>The problem is that a string with an "'" or an "&amp;" in it doesn't get matched by ILIKE correctly.</p>
  
  <p>So as an example, some strings that are stored in my DB and their parameterized versions:</p>
  
  <ol>
  <li>"This is a test" parameterized: "this-is-a-test" gsubbed: "this is a test"</li>
  <li>"He didn't do it" parameterized: "he didn-t-do-it" gsubbed: "he didn t do it"</li>
  <li>"This &amp; That" parameterized: "this-that" gsubbed: "this that"</li>
  </ol>
  
  <p>So when I do ILIKE between the first part of 2 and the third part of 2, it does not create a match. Same with 3. 1 obviously works fine though.</p>
  
  <p>Any ideas how to get a correct match even with special characters in the strings?</p>