Multiple Queries in active record ruby on rails :     `def c
     program = Program.first
     ids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
     members = Member.where(id: ids)
     for i in 0..ids.count-1
         members.find_by(id: ids[i]).location
     end
     end`

If I run the above query in rails console. multiple queries(Member object queries) are being fired(one for each value of i). The members are already in memory right(members variable)? How to get above-needed data making a single query. 

Member Load (0.2ms)  SELECT  `members`.* FROM `members` WHERE `members`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND `members`.`id` = 1 LIMIT 1
  ProfileAnswer Load (0.4ms)  SELECT `profile_answers`.* FROM `profile_answers` WHERE `profile_answers`.`member_id` = 1
  Member Load (0.4ms)  SELECT  `members`.* FROM `members` WHERE `members`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND `members`.`id` = 2 LIMIT 1
  ProfileAnswer Load (0.2ms)  SELECT `profile_answers`.* FROM `profile_answers` WHERE `profile_answers`.`member_id` = 2
  Member Load (0.2ms)  SELECT  `members`.* FROM `members` WHERE `members`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND `members`.`id` = 3 LIMIT 1
  ProfileAnswer Load (0.2ms)  SELECT `profile_answers`.* FROM `profile_answers` WHERE `profile_answers`.`member_id` = 3
  Member Load (0.2ms)  SELECT  `members`.* FROM `members` WHERE `members`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND `members`.`id` = 4 LIMIT 1
  ProfileAnswer Load (0.2ms)  SELECT `profile_answers`.* FROM `profile_answers` WHERE `profile_answers`.`member_id` = 4
  Member Load (0.2ms)  SELECT  `members`.* FROM `members` WHERE `members`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND `members`.`id` = 5 LIMIT 1
  ProfileAnswer Load (0.2ms)  SELECT `profile_answers`.* FROM `profile_answers` WHERE `profile_answers`.`member_id` = 5
  Member Load (0.4ms)  SELECT  `members`.* FROM `members` WHERE `members`.`id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND `members`.`id` = 6 LIMIT 1


P.S: I can't use member.each as the iterator is on different condition.