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
@account =[:account])
@account.register! if @account && @account.valid?
success = @account && @account.valid?
if success && @account.errors.empty?
flash[:notice] = “Thanks for signing up! We’re sending you an
email with your activation code.”
flash[:error] = “We couldn’t set up that account, sorry.
Please try again, or contact an admin (link is above).”
render :action => ‘new’

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

From the README
– clip –

  • –stateful: Builds in support for acts_as_state_machine and
    activation code. (@–stateful@ implies @–include-activation@).
    Based on the
    idea at [[
    stateful_authentication]]. Passing
    @–skip-migration@ will skip the user migration, and @–skip-routes@
    will skip
    resource generation – both useful if you’ve already run this
    – 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

@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.