src_data = [{90=>279}, {32=>400}]
ids = src_data.sort_by{|hash| hash.values.first}.reverse.collect(&:keys).flatten
# => [32,90]
ids should now be an array of ids, in order of highest score to lowest score. Now we can do the find.
@users = User.where("id in (?)", ids).order("ORDER BY FIELD(ID,#{ids.join(',')})")
This should generate sql like
select * from users where id in (32,90) ORDER BY FIELD(ID,32,90);
which should give you the users back in the right order.
EDIT - for postgres
Postgresql doesn't have the field()
function. You can define your own, see Simulating MySQL's ORDER BY FIELD() in Postgresql, but you might prefer to not bother and just reorder the results after you get them:
@users = User.where("id in (?)", ids).sort_by{|user| ids.index(user.id)}