title: ActiveRecord :includes - how to use map with loaded associations?
body: <p>I have a small rails app, and I'm trying to get some order statistics.
  So I have an Admin model, and an Order model, with one-to-many association.</p>
  
  <pre><code>class Admin &lt; ActiveRecord::Base
    attr_accessible :name
    has_many :orders
  class Order &lt; ActiveRecord::Base
    attr_accessible :operation
    belongs_to :admin
  </code></pre>
  
  <p>And I'm trying to get specifical orders using this query:</p>
  
  <pre><code>admins = Admin.where(...).includes(:orders).where('orders.operation = ?', 'new gifts!')
  </code></pre>
  
  <p>That works just as expected. But when I try to make json using map like that</p>
  
  <pre><code>admins.map {|a| [a.name, a.orders.pluck(:operation)]}
  </code></pre>
  
  <p>Rails loads orders again using new query, ignoring already loaded objects.</p>
  
  <pre><code>(5.6ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 26
  (6.8ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 24
  (2.9ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 30
  (3.3ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 29
  (4.8ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 27
  (3.3ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 28
  (5.1ms)  SELECT "orders"."operation" FROM "orders" WHERE "orders"."admin_id" = 25
  </code></pre>
  
  <p>When I try to use 
  loop instead of map, it works as it should:</p>
  
  <pre><code>admins.each do |a|
    p a.orders.pluck(:operation)
  end
  </code></pre>
  
  <p>this code doesn't load all orders, and prints only those loaded in the first query.
  Is it possible to get the same result using map? What are the drawbacks of using loop instead of map?</p>