ActiveRecord.find([id array]) question

You could search for past examples of this very question for starters, but here's a technique that will give you the result that you seek:

ids = [ 3, 1, 2 ]

results = User.find(ids) sorted_results = results.sort_by {|u| ids.index(u.id) }

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com