Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Ben's Profile

GitHub User: beingben

Comments by Ben

Avatar

Made my head hurt... but really great functionality.

It would be interesting to see this in conjunction with the offline app. It seems a whole client side application could persist and pull application updates from the main server when they are available. Potentially sync data, but really have everything live on the client indefinitely... making the web server a software distribution technology and data store rather than an application server technology. This would work wonders for scale.

Avatar

I found that I still wanted my users to be able to update their username and email address. Because using user.authentications allows a user to be created without a password devise will complain when prompting to change the info as it requires a current_password.
I used this to allow someone that is logged in via an external auth provider to update without entering a password. You could disable the need for the current_password completely if desired.

First time posting... huge fan - I started with episode 1 and have learned a lot along the way. Thank you Ryan!

views/registrations/edit.html.erb

erb
<% if @user.password_required? %>
.... password fields ...
<% end %>

user.rb

ruby
  def update_with_password(params={})
    unless self.authentications.empty?
      params.delete(:current_password)
      self.update_without_password(params)
    end
    super
  end