Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CommentsController
- Defined in:
- lib/app/controllers/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
4 5 6 7 |
# File 'lib/app/controllers/comments_controller.rb', line 4 def create @comment = @article.comments.create(comment_params.merge(user_id: current_user.id)) redirect_to article_path(@article) end |
#destroy ⇒ Object
9 10 11 12 13 14 |
# File 'lib/app/controllers/comments_controller.rb', line 9 def destroy @comment = @article.comments.find(params[:id]) @comment.destroy redirect_to article_path(@article), notice: "Comment Destroyed Successfully" end |