Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- before_action :set_post
- def create
- @post.comments.create! comments_params
- redirect_to @post
- end
- def set_post
- @post = Post.find(params[:post_id])
- end
- def comments_params
- params.required(:comment).permit(:body)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement