Skip to content

Instantly share code, notes, and snippets.

@VitorRibeiroCustodio
Last active August 15, 2019 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VitorRibeiroCustodio/6180752d6ec3f5feec05f502d9082167 to your computer and use it in GitHub Desktop.
Save VitorRibeiroCustodio/6180752d6ec3f5feec05f502d9082167 to your computer and use it in GitHub Desktop.
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