diff --git a/app/assets/javascripts/admin/comments.js.coffee b/app/assets/javascripts/admin/comments.js.coffee index b5489787a..98a91d148 100644 --- a/app/assets/javascripts/admin/comments.js.coffee +++ b/app/assets/javascripts/admin/comments.js.coffee @@ -36,7 +36,8 @@ ready = -> e.preventDefault() $.ajax url: $(this).attr('action') - headers: 'Content-Type': 'application/json' + data: + authenticity_token: $("meta[name='csrf-token']").attr("content") type: 'DELETE' success: () => numberWrapper = $(@).closest(".panel").find(".panel-heading .comments-number") diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index 938f5c908..71d36edb8 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -39,9 +39,9 @@ def update log_event if resource.update(update_params) respond_to do |format| - format.html do + format.html do render_flash_message_for(resource) - redirect_to([namespace_name, form_answer]) + redirect_to([namespace_name, form_answer]) end format.js { head :ok } end @@ -54,7 +54,7 @@ def destroy respond_to do |format| format.json { render(json: :ok)} - format.html do + format.html do render_flash_message_for(resource) redirect_to(admin_form_answer_path(form_answer)) end