Restful_authentication

I’ve decided to add user authentication to my application using
restful_authentication plugin. It has generated Account model with
such fragment of code:

def create
logout_keeping_session!
@account = Account.new(params[:account])
@account.register! if @account && @account.valid?
success = @account && @account.valid?
if success && @account.errors.empty?
redirect_back_or_default(’/’)
flash[:notice] = “Thanks for signing up! We’re sending you an
email with your activation code.”
else
flash[:error] = “We couldn’t set up that account, sorry.
Please try again, or contact an admin (link is above).”
render :action => ‘new’
end
end

Everything is clear to me except @account.register! method. I cannot
find any documentation about it. Where should I seek?

From the README
– clip –

Using --stateful when running the restful_authentication generator it
builds in support for acts_as_state_machine. If you are not using that
plugin then generate restful_authentication without the --stateful
option.

@user.register! is a state transition. If you are unfamiliar with
acts_as_state_machine, either read up on that and use it, or don’t use
the --stateful option.

P.S. @account in your case instead of @user.

Thanks. I’ll read about that.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs