title: Raw DB querying in Rails
body: <p>I'm trying to run the following raw query in rails, only to see it fail:</p>
  
  <pre><code>query   = 'SELECT * FROM users WHERE id IN ($1);'
  results = ActiveRecord::Base.connection.exec_query(query, "My query", [ [1,2] ]);
  </code></pre>
  
  <p><strong>What am I doing wrong?</strong></p>
  
  <p>The error I'm getting starts with this:</p>
  
  <pre><code>Could not log "sql.active_record" event. NoMethodError: undefined method `binary?' for 1:Fixnum
  </code></pre>
  
  <p>Clearly, I'm misusing <code>[1, 2]</code> bind params somehow, but I couldn't find a proper example myself.</p>
  
  <p>P.S. This is minimal failing example, derived of a much more advanced query that can't be turned into ActiveRecord chain of calls. In other words – I can't rely on Arel when building my query.</p>
  
  <p>P.P.S. I'm using <code>rails 4.0.1</code> and <code>postgresql 9.3</code></p>