title: How to query array column from mysql in Rails 5.2?
body: <p>I am using <code>gem rails~&gt; 5.2</code> and <code>gem mysql2 &gt;= 0.3.13, &lt; 0.5</code>.</p>
  
  <p>I have a model <code>Lawer</code>, which has an array column <code>lawer_filed</code> [sic]. </p>
  
  <pre><code># Model lawer.rb
  
  serialize :lawer_field, Array
  </code></pre>
  
  <p>Then I created a <code>Lawer</code>, and I can get the <code>lawer_field</code> value as follows:</p>
  
  <pre><code>=&gt; Lawer.first.lawer_field
  
  =&gt; ["2", "3", "5"] 
  </code></pre>
  
  <p>Now, I want to find one <code>Lawer</code> with a query using <code>lawer_field</code>. I tried:</p>
  
  <pre><code>@lawer = Lawer.where("lawer_field &amp;&amp; ARRAY[?]", "2")
  </code></pre>
  
  <p>which raised an error like this:</p>
  
  <pre><code>ActiveRecord::StatementInvalid (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['2']) LIMIT 11' at line 1: SELECT  `lawers`.* FROM `lawers` WHERE (lawer_field &amp;&amp; ARRAY['2']) LIMIT 11)
  </code></pre>
  
  <p>There is a mistake in my SQL syntax, but I don't how to fix it. Can anyone help?</p>