title: Eager load Rails 4 - still multiple queries
body: <p>I have this code:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
     has_many :people
  end
  
  class Person &lt; ActiveRecord::Base
     belongs_to :user
  end
  
  def map_people people
     people.map {|person|
       map_person(person)
     }
  end
  
  def map_person person
     {
       :person_id =&gt; person.id,
       :user_id =&gt; person.user.id,
       :name =&gt; person.user.name
     }
  end
  </code></pre>
  
  <p>and when I run:</p>
  
  <pre><code>map_people(Person.with_deleted.includes(:user))
  </code></pre>
  
  <p>I'm getting </p>
  
  <pre><code> Person Load (1.4ms)  SELECT `people`.* FROM `people`
   User Load (2.5ms)  SELECT `users`.* FROM `users` WHERE `users`.`deleted_at` IS NULL AND `users`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 78, 79, 80, 81, 83, 84, 85, 87, 88, 89, 90, 91, 92, 75, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 112, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 127, 128, 135, 142, 143)  ORDER BY users.updated_at DESC
   User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 1  ORDER BY users.updated_at DESC LIMIT 1
   User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 2  ORDER BY users.updated_at DESC LIMIT 1
   User Load (0.5ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 3  ORDER BY users.updated_at DESC LIMIT 1
   User Load (0.6ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 3  ORDER BY users.updated_at DESC LIMIT 1
   User Load (0.6ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 2  ORDER BY users.updated_at DESC LIMIT 1
   User Load (0.6ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 2  ORDER BY users.updated_at DESC LIMIT 1
   User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 1  ORDER BY users.updated_at DESC LIMIT 1
  </code></pre>
  
  <p>and and lot more SELECT 'users'.* FROM ..... queries</p>
  
  <p>Hos is possible to load all with one query?</p>
  
  <p>Thank you!</p>
  
  <p>David</p>