Topic: Sorting ActiveRecord results out of the database
I need to sort the results coming out from the database based on an array...
Let me explain better
I have something like this:
@results = Ad.select("ads.*, ... ") ...
That returns me an array of Ad objects
Then I have an array of ad.id in a given order: my_preferred_order = [123, 543, 78, 22, ...]
I need to get @results sorted with Ads in the array order...
How can I do that?
Thank you all.
Last edited by nimbuz77 (2012-12-14 04:19:29)