I'm attempting to lookup a list of stores using .where
but I'm also trying to keep them sorted as the same array of ids.
i.e
ids = ["4", "15", "10", "20", "1"]
stores = Store.published.where(id: ids)
It looks like stores is being returned in ascending order of the id so like
[{id: 20}, {id: 15} {id: 10}, {id: 4}, {id: 1}]
. I'd like to keep the returned stores ordered in the same way that ids
is ordered. Also note the ids in each store are ints whereas the ids in the ids
array are strings.