views:

216

answers:

1

Hi,

Pretty much have the Authlogic example type rails app setup. I'm getting the following error when I click on the registered link. From a generic point of view I can't quite see how the view "form.label :confirm_password" is support to run without raising an issue, noting that this field does not exist in the User table in the database?

Q1 - How is AuthLogic supposed to stop this form "confirm_password" not to be passed right back to the mode?

Q2 - Any ideas what is going wrong in my case below and how to address it? How does generally Rails handle ignoring a "confirm_password" type field in a form when processing, in the way that it (a) is required at the controller stage but (b) not required at the backend active_record stage.

ActionView::TemplateError (undefined method `confirm_password' for
#<User:0x2703fbc>) on line #8 of app/views/users/_form.erb:
5: <%= form.password_field :password %><br />
6: <br />
7: <%= form.label :confirm_password%><br />
8: <%= form.password_field :confirm_password %><br />
9: <br />

/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/attribute_methods.rb:260:in `method_missing'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:835:in `send'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:835:in `value_before_type_cast'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:823:in `value_before_type_cast'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:744:in `to_input_field_tag'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:557:in `password_field'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:943:in `send'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_view/
helpers/form_helper.rb:943:in `password_field'
/Users/greg/Dropbox/source/myapp/app/views/users/_form.erb:8:in
`_run_erb_app47views47users47_form46erb_locals_form_object'
/Users/greg/Dropbox/source/myapp/app/views/users/new.html.erb:5:in
`_run_erb_app47views47users47new46html46erb'
/Users/greg/Dropbox/source/myapp/app/views/users/new.html.erb:3:in
`_run_erb_app47views47users47new46html46erb'

macintosh-2:myapp greg$ find . -name *.rb | xargs grep -i confirm_password
./app/controllers/application_controller.rb:
filter_parameter_logging :password, :confirm_password

Regards

A: 

had to change it to ":password_confirmation" and it worked - was an AuthLogic thing....

Greg
`password_confirmation` is what's called a "virtual attribute" in ActiveRecord. There is no corresponding field in the db.
Jonathan Julian