I need my blog posts to display the opposite way. post 1 should be underneath post 2, etc.
This is my code which loops through the posts & renders them:
<% @posts.each do |post| %>
<div>
<div><%= post.name %></div>
<div><%= post.title %></div>
<div><%= post.content %></div>
<div><%= link_to 'Show', post %></div>
<div><%= link_to 'Edit', edit_post_path(post) %></div>
<div><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></div>
</div>
<% end %>
Sort them before assigning them to
@postsin the controller …in rails 3:
The benefit here is with a little work you can also sort by other columns too…