I have method
def self.get_ayahs_by_array(ayahs_keys_array)
self.where(ayah_key: ayahs_keys_array)
end
Which does a query on the Quran::Ayah
model. ayahs_keys_array
is an array of keys (primary_key) in a certain order. The query returns a different order, but I want it to return as the same order as the queried array.
Example: ayahs_keys_array
is [5,4,1,2,7]
and I want it to return in THAT order and not [1,2,4,5,7]
Any ideas?
Aucun commentaire:
Enregistrer un commentaire