Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CommentsController < ApplicationController
- def create
- @post = Post.find(params[:post_id])
- @post.comments.create(post_params)
- redirect_to post_path(@post)
- end
- private
- def post_params
- params.require(:comment).permit(:name, :body)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement