my_hash = {}
@objects.each { |obj| my_hash[obj.id] = obj }
my_array.collect{ |id| my_hash[id] }
Last active
August 29, 2015 14:17
-
-
Save vdw/2fabb09c397e25d46930 to your computer and use it in GitHub Desktop.
Sort array of objects based on given order of ids (ruby)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment