Last active
August 15, 2019 12:02
-
-
Save VitorRibeiroCustodio/6180752d6ec3f5feec05f502d9082167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment