Class: Spina::Admin::UsersController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- Spina::ApplicationController
- AdminController
- Spina::Admin::UsersController
- Defined in:
- app/controllers/spina/admin/users_controller.rb
Instance Method Summary collapse
Methods inherited from AdminController
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/spina/admin/users_controller.rb', line 17 def create @user = User.new(user_params) I18n.t('spina.users.new') if @user.save redirect_to admin_users_url else flash.now[:alert] = I18n.t('spina.users.cannot_be_created') render :new end end |
#destroy ⇒ Object
42 43 44 45 |
# File 'app/controllers/spina/admin/users_controller.rb', line 42 def destroy @user.destroy unless @user == current_spina_user redirect_to admin_users_url end |
#edit ⇒ Object
28 29 30 |
# File 'app/controllers/spina/admin/users_controller.rb', line 28 def edit "#{@user}" end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/spina/admin/users_controller.rb', line 8 def index @users = User.all end |
#new ⇒ Object
12 13 14 15 |
# File 'app/controllers/spina/admin/users_controller.rb', line 12 def new @user = User.new I18n.t('spina.users.new') end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/spina/admin/users_controller.rb', line 32 def update "#{@user}" if @user.update(user_params) redirect_to spina.admin_users_url else flash.now[:alert] = I18n.t('spina.users.cannot_be_created') render :edit end end |