Skip to content

Doc needs: How to save @user correctly #14

Description

@audreylee88

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions