Sha256: 5794341832fef02a92b76ff724d1b3b604575581c6afc35740638a63ab62cc37

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

# Users Controller
#
# Provides a user/account management interface.
class UsersController < AuthorizedController
  # Actions
  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

  def current
    redirect_to current_user
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bookyt-0.0.1 app/controllers/users_controller.rb