Let’s say I want to return the last entry in a model, it is easy. The most recent post is found as (assuming descending order)
@post = Post.last
What if I wanted the 10 most recent posts ie
@recentposts = Post.#whatdoIputhere?
How could I most easily and efficiently do this?
Thanks!
Try this: