map(&:id) work but not pluck(:id) <p>In part of my code I need to grab users's id but <code>pluck</code> doesn't grab them. Only <code>map(&amp;:id)</code> can do it. I was wondering why.</p> <p>I've wrote a quick and dirty block of code to find what's happen</p> <pre><code> def remove_users user_ids p users_to_remove.class users_to_remove = self.users.where(id: user_ids) if users_to_remove.present? self.users -= users_to_remove self.save p users_to_remove.class p users_to_remove Rails::logger.info "\n#{users_to_remove}\n" users_to_remove_map = users_to_remove.map(&amp;:id) p users_to_remove_map Rails::logger.info "\nmap id: #{users_to_remove_map}\n" users_to_remove_pluck = users_to_remove.pluck(:id) p users_to_remove_pluck Rails::logger.info "\npluck id: #{users_to_remove_pluck}\n" #... end self.user_ids end </code></pre> <p>Who return in my test.log </p> <pre><code>#&lt;User::ActiveRecord_AssociationRelation:0x007fb0f9c64da8&gt; map id: [144004] (0.3ms) SELECT "users"."id" FROM "users" INNER JOIN "groups_users" ON "users"."id" = "groups_users"."user_id" WHERE "groups_users"."group_id" = $1 AND "users"."id" IN (144004, 144005) [["group_id", 235819]] pluck id: [] </code></pre> <p>And in my test</p> <pre><code>User::ActiveRecord_AssociationRelation User::ActiveRecord_AssociationRelation #&lt;ActiveRecord::AssociationRelation [#&lt;User id: 144004, created_at: "2015-08-06 08:55:11", updated_at: "2015-08-06 08:55:11", email: "user_2@test.com", token: "rpf5fqf5bs1ofme6aq66fwtcz", reset_password_token: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, disabled: false, first_name: "John_2", last_name: "Rivers_4", is_owner: false, organisation_id: 235826, encrypted_password: "$2a$04$8ev1j...f6ICL.ezS....", reset_password_sent_at: nil, default_language: nil, uid: nil, api_key: "rmhh...noyn"&gt;]&gt; [144004] [] </code></pre> <p>The strange thing is. I have user with id. <code>map</code> can get them. <code>pluck</code> not.</p> <p>I don't understand sql log also. How can I get <code>map id</code> result without any select in sql log? Caching ?</p>