authlogic_openid icon indicating copy to clipboard operation
authlogic_openid copied to clipboard

Doc needs: How to save @user correctly

Open audreylee88 opened this issue 15 years ago • 0 comments
trafficstars

Hi there,

I need help writing the create() method in the users_controller.

So perhaps this could label this as a "documentation bug".

Anyway, in my users controller, I wrote this:

def create @user = User.new(params[:user]) debugger @user.save do |result| if result flash[:notice] = "Account registered!" redirect_back_or_default account_url else render :action => :new end end end

When control hits

@user.save do |result|

control transfers to this file:

http://github.com/binarylogic/authlogic_openid/blob/master/lib/authlogic_openid/acts_as_authentic.rb

then to this line:

def save(perform_validation = true, &block) return false if perform_validation && block_given? && authenticate_with_openid? && !authenticate_with_openid

Once here, the debugger is telling me that block_given? is false.

This is wrong.

block_given? should be true.

So, perhaps I wrote create() incorrectly?

The doc only gives syntax for the saving of UserSession objects.

Please offer clues.

Thanks, --Audrey

audreylee88 avatar Jan 09 '10 07:01 audreylee88