I have an array of ids, stored in some external storage (rails cache or redis). In controller\'s action I fetch this data and select object using it, i.e.
id
If you don't mind receiving an array instead of an ActiveRecord Collection, you can use:
result = MyModel.find(ids).sort_by {|m| ids.index(m.id)}