When you point the browser to /posts/new , it displays the new action, which presents you with a form to fill out (defined in app/views/posts/new.html.erb and app/views/posts/_form.html.erb ). When you click the submit button in your form, it sends your data to the create action, which actually creates a record in the database.
Looking at your PostsController code, you probably don't want to have a line
@post.save
in your action, new , as this will save an empty record in the database - whether the user will fill out the form or not. And you probably want to move
@post.user_id = current_user.id
to your create action, since it is you who actually save the message in the database.
source share