About #ids Instead of doing: user_ids = users.pluck(:id) Starting Rails 4.0.2 you can do: user_ids = users.ids