Class: UsersController

Inherits:
AuthorizedController show all
Defined in:
app/controllers/users_controller.rb

Overview

Users Controller

Provides a user/account management interface.

Instance Method Summary collapse

Methods inherited from AuthorizedController

#set_locale

Instance Method Details

#currentObject



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

def current
  redirect_to current_user
end

#updateObject

Actions



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/users_controller.rb', line 6

def update
  @user = User.find(params[:id])

  # Don't try to update password if not provided
  if params[:user][:password].blank?
    [:password, :password_confirmation, :current_password].collect{|p| params[:user].delete(p) }
  end

  # Test if user is allowed to change roles
  params[:user].delete(:role_texts) unless can? :manage, Role

  # Set the locale explicitly to the user cause it wasn't saved.
  @user.locale = params[:user][:locale] if params[:user][:locale]

  update!
end