I have a set of @users objects, each of which has its id attribute.
@users = [#<User id:1>, #<User id:2>]
I also have an ordered ids array.
ids = [2,1]
ΒΏIs there a magical way to sort the collection using this list of identifiers? Do not make another call to the database if possible.
Thanks!!!
sorting ruby ruby-on-rails
dgilperez
source share