Form field without column in DB

I’m using authenticated gem and adding turing to it… I’d like to
pass a form variable back to the controller. but there is no need to
keep it in the DB. the form renders fine the initial time. but fails
if it fails when the controller tries to display the form with data
when the user gives bad input… password and password confirm don;t
match. should i just add the field to the db or is there a better
way?

last newbie question for tonight!! Thanks for all the help!

spokra wrote:

I’m using authenticated gem and adding turing to it… I’d like to
pass a form variable back to the controller. but there is no need to
keep it in the DB. the form renders fine the initial time. but fails
if it fails when the controller tries to display the form with data
when the user gives bad input… password and password confirm don;t
match. should i just add the field to the db or is there a better
way?

last newbie question for tonight!! Thanks for all the help!

No need to add that field to the db.

The password field can be given as:
password_field :password
and the password confirmation field given as:
password_field :password_confirmation
and add a validation in the model as validates_confirmation_of :password

There will be only ‘password’ field in the db.

ok I put turing=session[‘turning’] in my controller, added a
turing_confirmation field to the view and the
validates_confirmation_of :turning to the model.

now i get the folling error!
undefined method `turing’ for #Accounts:0xa6fef0c8

I assume that this is being caused because AR is thinking that it
should be putting turing into a column of the DB. how do I tell AR
that it shouldn;t do that?

turing and turing_confirmation are not in the DB they are just there
to perform Captcha on the creation of the account.

On Dec 26, 11:38 pm, Vidya Ramachandren <rails-mailing-l…@andreas-

so if i have a session variable session[‘turing’] and submit
turing_confirmation will the

validates_confirmation_of :turing

catch it? or will i have to get the session variable into a local
variable some how? my guess would be to put :turing=session[‘turing’]
in the controller…

and i take it i will have to add :turing to the list in.

attr_accessible :login, :email, :password, :password_confirmation,
:turing_configure

On Dec 26, 11:38 pm, Vidya Ramachandren <rails-mailing-l…@andreas-

The Account model needs a setter method in order to have the turing
value assigned to it, which it sounds like you’ve done.
How are you assigning the values to the model object, in the controller?

Doug

On Dec 27, 2007, at 11:56 AM, spokra wrote:

Am i going down the wrong path here?

validates_confirmation_of :turning to the model.

fails
password_field :password

Doug Pfeffer
Developer,
[email protected]

well i just tried

params[:accounts] = {:turing => session[‘turing’]}

which whipes out all the other values in the hash… I got the
ruby_debugger installed and now can view the application while its
running.

Hmmm adding a method of turing in the model got rid of the error!!

but the validate is not working. I stuffed the session variable
turing into the params like this in the controller

params[:turing] = session[‘turing’]

My thinking is AR knows how to find the submited form… so i would add
it from the controller…
Am i going down the wrong path here?

I’m a carpy programmer if i was in php I would just output both
turing and turing_confirmation in a debug statement in my code… other
then learning how to use the debugger how can a verify that I’m
getting the variables set correctly?

Um, why are you adding all of those attr_accessors? So you get access to
the
login field in the database? You do not need to do this! ActiveRecord
does
it for you!


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

no I’m not trying to get the turing to the db… the text of the
turing in in a session variable. and the form returns the users
confirmation of the turing image. I just want to use active records
to verify the two…