Closed klinskyc closed 9 years ago
I'm currently trying to update parts of my user model without a password. After reading the Devise Docs I found this page, https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password. I cannot get update_without_password to work in my users or registration controller.
authorize! :update, @user, :message => 'Not authorized as an administrator.' @user = User.find(params[:id]) role = Role.find(params[:user][:role_ids]) unless params[:user][:role_ids].nil? params[:user] = params[:user].except(:role_ids) if @user.update_without_password(params[:user])
@user.update_without_password(role) unless role.nil? redirect_to users_path, :notice => "User updated." else redirect_to users_path, :alert => "Unable to update user." end
end
Any Ideas?
There is a new version of this application for Rails 4.2 using the Payola gem.
I'm currently trying to update parts of my user model without a password. After reading the Devise Docs I found this page, https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password. I cannot get update_without_password to work in my users or registration controller.
authorize! :update, @user, :message => 'Not authorized as an administrator.' @user = User.find(params[:id]) role = Role.find(params[:user][:role_ids]) unless params[:user][:role_ids].nil? params[:user] = params[:user].except(:role_ids) if @user.update_without_password(params[:user])
@user.update_without_password(role) unless role.nil? redirect_to users_path, :notice => "User updated." else redirect_to users_path, :alert => "Unable to update user." end
Any Ideas?