With :limit
in query, I will get first N records. What is the easiest way to get last N records?
Ruby-on-rails – How to get last N records with activerecord
activerecordrubyruby-on-rails
Related Topic
- Ruby-on-rails – How to understand nil vs. empty vs. blank in Ruby
- Ruby – How to write a switch statement in Ruby
- Ruby-on-rails – How to get the current absolute URL in Ruby on Rails
- Ruby-on-rails – How to drop columns using Rails migration
- Ruby-on-rails – Ruby: What is the easiest way to remove the first element from an array
- Ruby – How to map with index in Ruby
- Ruby-on-rails – How to return an empty ActiveRecord relation
- Ruby-on-rails – How to remove a key from Hash and get the remaining hash in Ruby/Rails
Best Answer
This is the Rails 3 way