title: Rails: Is it possible to select has_many association column id as array
body: <p>I have following models and has_and_belongs_to_many relationship, when I select my products </p>
  
  <pre><code>products =  Product.where()...., 
  </code></pre>
  
  <p>is it possible to select the associated stores ids or other store column as array in my query? so I can do </p>
  
  <pre><code>products[0].store_ids
  </code></pre>
  
  <p>to check what stores it belongs to.</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
     has_and_belongs_to_many :store
  end
  
  class Store &lt; ActiveRecord::Base
     has_and_belongs_to_many :products
  end
  </code></pre>