Class: Oxen::UsersController
- Inherits:
-
AbstractResourcesController
- Object
- AbstractResourcesController
- Oxen::UsersController
- Defined in:
- app/controllers/oxen/users_controller.rb
Instance Method Summary collapse
- #confirm ⇒ Object
-
#update ⇒ Object
def index @users = User.all authorize User end def index @resources = policy_scope(User) authorize User end.
Instance Method Details
#confirm ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/oxen/users_controller.rb', line 6 def confirm resource if resource.confirm flash[:info] = t('user.confirmed_ok') render :confirm, layout: false, status: 200 and return else flash[:info] = t('user.not_confirmed_ok') render :confirm, layout: false, status: 401 and return end end |
#update ⇒ Object
def index
@users = User.all
User
end def index
@resources = policy_scope(User)
User
end
def show
@user = User.find(params[:id])
@user
end
def update
@user = User.find(params[:id])
@user
if @user.update_attributes(secure_params)
redirect_to users_path, :notice => "User updated."
else
redirect_to users_path, :alert => "Unable to update user."
end
end
def destroy
user = User.find(params[:id])
user
user.destroy
redirect_to users_path, :notice => "User deleted."
end
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/oxen/users_controller.rb', line 47 def update if params[:user][:password].blank? && params[:user][:password].blank? params[:user].delete :password params[:user].delete :password_confirmation end resource resource.max_role = current_user.role if resource.update_attributes(secure_params) redirect_to users_path, :notice => "User updated." else render :edit, :alert => "Unable to update user." end # super end |