Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CommentsController
- Defined in:
- app/controllers/comments_controller.rb
Overview
Comments
Instance Method Summary collapse
-
#check ⇒ Object
post /comments/check.
-
#create ⇒ Object
post /comments.
-
#destroy ⇒ Object
delete /comments/:id.
-
#edit ⇒ Object
get /comments/:id/edit.
-
#show ⇒ Object
get /comments/:id.
-
#update ⇒ Object
patch /comments/:id.
Instance Method Details
#check ⇒ Object
post /comments/check
11 12 13 14 15 |
# File 'app/controllers/comments_controller.rb', line 11 def check @entity = Comment.instance_for_check(params[:entity_id], entity_parameters) render 'shared/forms/check' end |
#create ⇒ Object
post /comments
18 19 20 21 22 23 24 |
# File 'app/controllers/comments_controller.rb', line 18 def create if params.key?(:agree) emulate_creation else create_comment end end |
#destroy ⇒ Object
delete /comments/:id
40 41 42 43 44 45 |
# File 'app/controllers/comments_controller.rb', line 40 def destroy if @entity.update deleted: true flash[:notice] = t('comments.destroy.success') end redirect_to(@entity.commentable || admin_comments_path) end |
#edit ⇒ Object
get /comments/:id/edit
27 28 |
# File 'app/controllers/comments_controller.rb', line 27 def edit end |
#show ⇒ Object
get /comments/:id
48 49 50 |
# File 'app/controllers/comments_controller.rb', line 48 def show redirect_to(admin_comment_path(id: params[:id])) end |
#update ⇒ Object
patch /comments/:id
31 32 33 34 35 36 37 |
# File 'app/controllers/comments_controller.rb', line 31 def update if @entity.update entity_parameters form_processed_ok(admin_comment_path(id: @entity.id)) else form_processed_with_error(:edit) end end |