Commit 3ebbf0aa authored by John Noel's avatar John Noel

Added Posts create function

parent 8a518714
......@@ -10,6 +10,21 @@ class PostsController < ApplicationController
@post = Post.new
end
def create
@post = Post.new(post_params)
if @post.save
redirect_to posts_path, notice: "You have successfully created a new post."
else
render 'new'
end
end
def edit
end
private
def post_params
params.require(:post).permit!
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment