This code will fulfill your initial request.
@records = Model.find_all_by_column('value', :order => 'created_at DESC')
And regarding your observation. If you want to iterate over the returned array, you can do the following
@records.each do |record|
Inside the iterator, you can set a flag when you see a specific record, then do something with the next record in the iterator.
If you want to check if there are any records in the array returned by finder, then you can check @ records.length
source share