几乎有Authlogic 示例类型的 rails 应用程序设置。单击已注册的链接时出现以下错误。从一般的角度来看,我不太清楚视图“form.label:confirm_password”如何支持运行而不会引发问题,注意到数据库中的用户表中不存在该字段?
Q1 - AuthLogic 应该如何阻止这种形式“confirm_password”不被传递回模式?
Q2 - 任何想法在我下面的案例中出了什么问题以及如何解决它?Rails 通常如何处理在处理时忽略表单中的“confirm_password”类型字段,方式是(a)在控制器阶段需要但(b)在后端 active_record 阶段不需要。
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
问候