Class: UsersController

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



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

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

#editObject



16
17
# File 'app/controllers/users_controller.rb', line 16

def edit
end

#indexObject



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

def index
  @users = User.order('name ASC').paginate(page: params[:page], per_page: 10)
end

#resourceObject



32
33
34
# File 'app/controllers/users_controller.rb', line 32

def resource
  @user
end

#showObject



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

def show
end

#updateObject



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

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