I have the following data in the database:
1 2 3 4 5
And I would like to get this:
3 4 5
I need this to print in a view:
<%car.colors.limit(3).order('created_at ASC').each do |color|%> ...
I know there is reverse_order , but is there something like reverse sort ?
(I know that you can load data into an array and then go through the array, but this method is not very efficient)
sorting database mysql activerecord ruby-on-rails-3
user984621
source share