# Restful\_authentication with --stateful option

**URL:** <https://www.ruby-forum.com/t/restful-authentication-with-stateful-option/128339>\
**Category:** Rails\
**Created:** [February 6, 2008, 10:16pm UTC](https://www.ruby-forum.com/t/restful-authentication-with-stateful-option/128339 "2008-02-06T22:16:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bruz](https://www.ruby-forum.com/u/bruz)\
**Post date:** [February 6, 2008, 10:16pm UTC](https://www.ruby-forum.com/t/restful-authentication-with-stateful-option/128339/1 "2008-02-06T22:16:25Z")

</div>

I’ve been using restful\_authentication for several months, and noticed  
there have been some security fixes so I figured it was time to  
upgrade. I ran into an error, and thought it might have been specific  
to the app I’m working on, but I tried creating an app from scratch  
and setting up restful\_authentication and get the same error. Here’s  
what I tired:

rails test\_app  
cd test\_app  
script/plugin install restful\_authentication  
script/plugin install  
[http://elitists.textdriven.com/svn/plugins/acts\_as\_state\_machine/trunk](http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk)  
script/generate authenticated user sessions --include-activation –  
stateful

# configure database.yml

rake db:migrate  
script/server

Then when I go to [http://localhost/users/new](http://localhost/users/new) and try to sign up a new  
user, I get the following:

NameError (undefined local variable or method `record' for #<UsersController:0xb7be35ec>): /app/controllers/users_controller.rb:21:in `create’

Has anyone else seen this? I’m running rails 2.0.2, and using the  
latest versions of the plugins as of today (2/6/2008). If I leave out  
the --stateful option, everything works, but of course I’m not using  
all of the acts\_as\_state\_machine improvements to  
restful\_authentication.

Thanks,  
Bruz

---

<div class="post-metadata">

**Author:** ![bruz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bruz](https://www.ruby-forum.com/u/bruz)\
**Post date:** [February 7, 2008, 1:43pm UTC](https://www.ruby-forum.com/t/restful-authentication-with-stateful-option/128339/2 "2008-02-07T13:43:24Z")

</div>

Hi Bruz,

Yes, I have the same problem and no solution yet.

NameError in UsersController#create  
undefined local variable or method `record’ for #\<UsersController:  
0x2c516e0\>

At least your post tells me that leaving out the -stateful option will  
work BUT I need this option.

Rgs  
euro

---

<div class="post-metadata">

**Author:** ![bruz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bruz](https://www.ruby-forum.com/u/bruz)\
**Post date:** [February 7, 2008, 5:25pm UTC](https://www.ruby-forum.com/t/restful-authentication-with-stateful-option/128339/3 "2008-02-07T17:25:06Z")

</div>

Hi,

I was getting this problem too.

In UserController, change:

@user.register! if record.valid?

to

@user.register! if @user.valid?

Working fine for me now.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![bruz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bruz](https://www.ruby-forum.com/u/bruz)\
**Post date:** [February 8, 2008, 2:01am UTC](https://www.ruby-forum.com/t/restful-authentication-with-stateful-option/128339/4 "2008-02-08T02:01:38Z")

</div>

That did the trick! Somehow I figured that the error was just a  
symptom of a bigger problem, but in this case I guess it was just that  
one line of code. Thanks!
