Clean way to find ActiveRecord objects by id in the order specified
It’s not that MySQL and other DBs sort things on their own, it’s that they don’t sort them. When you call Model.find([5, 2, 3]), the SQL generated is something like: SELECT * FROM models WHERE models.id IN (5, 2, 3) This doesn’t specify an order, just the set of records you want returned. It turns … Read more