title: Escape character for underscore in Ruby on Rails queries
body: <p>What I'm trying to do is to write a query like the following:</p>
  
  <pre><code>Foo.where("bar LIKE 'bam\_%'")
  </code></pre>
  
  <p>The idea being that this would return all the rows where bar, which contains a string, starts with 'bam_' and then is of an indeterminate length thereafter. I've tried this as a pure MySQL query in the MySQL workbench and it seems to work as expected. When I do this in RoR, however, it seems to ignore the escape character completely and treats underscore like the wildcard that it really is. Is there not a way to write this in Rails where I can include the underscore in my query? Thanks.</p>