Sha256: 05f7d36de5aa2e609212f276c0bdbfd6eb0eb100c99f209a3754547ba21d58eb
Contents?: true
Size: 542 Bytes
Versions: 68
Compression:
Stored size: 542 Bytes
Contents
class CommentsController < ApplicationController http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy def create @post = Post.find(params[:post_id]) @comment = @post.comments.create(comment_params) redirect_to post_path(@post) end def destroy @post = Post.find(params[:post_id]) @comment = @post.comments.find(params[:id]) @comment.destroy redirect_to post_path(@post) end private def comment_params params.require(:comment).permit(:commenter, :body) end end
Version data entries
68 entries across 68 versions & 2 rubygems