title: Rails and Oracle: execute sql statement and get all data
body: <p>I have a rather complex sql statement that is created on the fly. But the same problem exists for a simple query, so I use this one as an example.</p>
  
  <p>I have a Feature model. I can call <code>Feature.count</code> --> 4</p>
  
  <p>But if I try to get all Feature ids using <code>ActiveRecord::Base.connection.execute("SELECT ID from features")</code> the result is a <code>OCI8::Cursor</code> object. I do not know how to get the data out of it.</p>
  
  <p>If I try <code>ActiveRecord::Base.connection.execute("SELECT ID from features").fetch</code> I get <code>[1]</code>. With <code>xyz.fetch_hash</code> I get <code>{"ID" =&gt; 1}</code>.</p>
  
  <p>I would like to have all IDs.
  I just switched from PostgreSQL to Oracle.</p>
  
  <p>Using PostgreSQL, I got all data using <code>ActiveRecord::Base.connection.execute("SELECT ID from features").to_a</code>, but <code>to_a</code> does not exist using the <code>activerecord-oracle_enhanced-adapter</code> gem (<code>*** NoMethodError Exception: undefined method 'to_a' for #&lt;OCI8::Cursor:0x00000007028aa8&gt;</code>).</p>
  
  <p>I am using Ruby 2.0 and Rails 4. The connection to the Oracle database is working, except my manually created statement.</p>