Step 10 has the following instructions but I have absolutely no idea what I need to do - can anyone offer guidance? I added spaces in the html code to stop the li/ul from screwing the formatting.
Set up the posts#index controller action to handle GET requests:
In the Posts controller, make an action named index:
def index @new_post = Post.new @all_posts = Post.order(created_at: :desc).all end
We'll use @new_post in the view to render a form.
We'll use @all_posts to render a list of all posts, sorted in descending order.
In app/views/posts/index.html, create a Rails form with the fields of the @new_post object to post comments.
Replace the hardcoded < ul> element by using @all_posts:
< ul class="comments"> <% @all_posts.each do |p| %> < li><%= p.comment %> <% end %>
Here we loop through each element in @all_posts and display it in an < li> element.
For the first step, I have this:
class PostsController < ApplicationController
@new_post = Post.new
@all/posts = Post.order(created_at: :desc).all
But from there I am lost