Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CommentsController
- Defined in:
- app/controllers/comments_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/comments_controller.rb', line 12 def create @comment = @commentable.comments.new(comment_params.merge(commenter: current_user)) @comment respond_to do |format| format.html do if @commentable.save redirect_to @commentable, status: :see_other else render :nothing, status: :unprocessable_content end end end end |
#destroy ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/comments_controller.rb', line 26 def destroy @comment respond_to do |format| format.html do if @comment.destroy! redirect_to @commentable, status: :see_other, notice: t(".destroyed") else render :nothing, status: :unprocessable_content end end end end |
#show ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/comments_controller.rb', line 5 def show respond_to do |format| format.activitypub format.html { redirect_to @commentable, status: :see_other } end end |