RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.
http://railsapps.github.io/rails-stripe-membership-saas
1.14k stars 232 forks source link

Update Parts of User Without Table #58

Closed klinskyc closed 9 years ago

klinskyc commented 11 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?

DanielKehoe commented 9 years ago

There is a new version of this application for Rails 4.2 using the Payola gem.