Class: UsersController

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



25
26
27
28
# File 'app/controllers/users_controller.rb', line 25

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

#editObject



14
15
# File 'app/controllers/users_controller.rb', line 14

def edit
end

#indexObject



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

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

#resourceObject



30
31
32
# File 'app/controllers/users_controller.rb', line 30

def resource
  @user
end

#updateObject



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

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