With :limit in query, I will get first N records. What is the easiest way to get last N records?
:limit
This is the Rails 3 way
SomeModel.last(5) # last 5 records in ascending order SomeModel.last(5).reverse # last 5 records in descending order
2.1m questions
2.1m answers
60 comments
57.0k users