Class: UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



23
24
25
26
# File 'app/controllers/users_controller.rb', line 23

def destroy
  @user.destroy
  redirect_to users_url, notice: t('general.form.destroyed')
end

#editObject



12
13
# File 'app/controllers/users_controller.rb', line 12

def edit
end

#indexObject



8
9
10
# File 'app/controllers/users_controller.rb', line 8

def index
  @users = User.order('name ASC')
end

#resourceObject



28
29
30
# File 'app/controllers/users_controller.rb', line 28

def resource
  @user
end

#updateObject



15
16
17
18
19
20
21
# File 'app/controllers/users_controller.rb', line 15

def update
  if params[:user][:password].present? ? @user.update_attributes(params[:user]) : @user.update_without_password(params[:user])
    redirect_to edit_user_path(current_user), notice: t('general.form.successfully_updated')
  else
    render :edit
  end
end