From c3f17592bc9e12eab4329f9a841db1f270d4a188 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Mon, 25 May 2015 11:29:22 +0300 Subject: [PATCH] Delete users --- app/controllers/management/users_controller.rb | 7 +++++++ app/views/management/users/index.html.slim | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index c1d75f4..b70a7cf 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -29,6 +29,13 @@ module Management end end + def destroy + @user = find_user + @user.destroy + + redirect_to action: :index + end + private def find_user diff --git a/app/views/management/users/index.html.slim b/app/views/management/users/index.html.slim index add033f..d608b95 100644 --- a/app/views/management/users/index.html.slim +++ b/app/views/management/users/index.html.slim @@ -26,5 +26,5 @@ = icon :eye = link_to edit_management_user_path(user), title: t('actions.edit.button', model: User.model_name.human), class: 'btn btn-primary' = icon :edit - = link_to management_user_path(user), title: t('actions.destroy.button', model: User.model_name.human), class: ['btn', 'btn-danger'], remote: true, method: :delete, data: {confirm: t('actions.are_you_sure')} + = link_to management_user_path(user), title: t('actions.destroy.button', model: User.model_name.human), class: ['btn', 'btn-danger'], method: :delete, data: {confirm: t('actions.are_you_sure')} = icon :trash