Class: System::Admin::UsersController

Inherits:
Controller
  • Object
show all
Defined in:
app/controllers/system/admin/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject


20
21
22
23
24
25
26
# File 'app/controllers/system/admin/users_controller.rb', line 20

def destroy
  if @user.destroy
    redirect_to admin_users_path, success: t('.success', user: @user.name)
  else
    redirect_to admin_users_path, danger: @user.errors.full_messages.to_sentence
  end
end

#indexObject


6
7
8
9
10
# File 'app/controllers/system/admin/users_controller.rb', line 6

def index
  load_users
  load_counts
  @instances_preload_service = User::InstancePreloadService.new(@users.map(&:id))
end

#updateObject


12
13
14
15
16
17
18
# File 'app/controllers/system/admin/users_controller.rb', line 12

def update
  if @user.update_attributes(user_params)
    flash.now[:success] = t('.success', user: @user.name)
  else
    flash.now[:danger] = @user.errors.full_messages.to_sentence
  end
end