Add comments'
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :set_article
|
||||
|
||||
def create
|
||||
@article.comments.create! params.required(:comment).permit(:content)
|
||||
redirect_to @article
|
||||
end
|
||||
|
||||
private
|
||||
def set_article
|
||||
@article = Article.find(params[:article_id])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user