I’m fairly new to working with Ruby on Rails.
I’ve created a blog called “posts”, and I want my homepage to display the 2 latest entries…
I’ve so far got it displaying ALL blog posts using
<% @posts.each do |post| %>
but how do I modify this to show only the latest 2?
Many thanks.
1 Answer