I am trying to perform:
@people = Person.find(10,14,5,1)
The RUBY is acting intelligent in fetching the rows, it is sorting my
array and fetching the corresponding rows: Essentially I am returned
with rows 1,5,10 and 14 in that order..
It is essential for me to retain the order, can I force this happen?
Regards,
Sandeep G
--
Posted via http://www.ruby-forum.com/.
ids = [10,14,5,1]
@people = Person.find ids, :order => "field(id,#{ids.join(',')})"
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field
--
We develop, watch us RoR, in numbers too big to ignore.