Find ActiveRecord with order

Posted . Visible to the public.
ids =[1,3,5,9,6,2]
indexed_people = Person.find(ids).index_by(&:id)
people_in_order = indexed_people.values_at(*ids)
Manic Chuang
Posted by Manic Chuang to Ruby/Rails Tip (2014-01-24 07:57)