我在Rails 3.0.3和ruby 1.8.7上使用design 1.3.4进行用户身份验证/授权和新用户创建。(我在设计和omniauth上遵循了Ryan的railscast,但也使用了可确认的选项)
当数据库中没有用户时,它可以正常工作。然而,当我注销唯一的用户并尝试创建一个新用户时,我会得到以下错误:
undefined method `encode!' for "Confirmation":String
这是完整的堆栈跟踪:
ail (2.2.17) lib/mail/fields/unstructured_field.rb:169:in `encode'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:138:in `fold'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:108:in `wrapped_value'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:70:in `do_encode'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:52:in `encoded'
mail (2.2.17) lib/mail/field.rb:122:in `send'
mail (2.2.17) lib/mail/field.rb:122:in `method_missing'
mail (2.2.17) lib/mail/header.rb:190:in `encoded'
mail (2.2.17) lib/mail/header.rb:189:in `each'
mail (2.2.17) lib/mail/header.rb:189:in `encoded'
mail (2.2.17) lib/mail/message.rb:1707:in `encoded'
actionmailer (3.0.3) lib/action_mailer/base.rb:420:in `set_payload_for_mail'
actionmailer (3.0.3) lib/action_mailer/base.rb:400:in `deliver_mail'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionmailer (3.0.3) lib/action_mailer/base.rb:399:in `deliver_mail'
mail (2.2.17) lib/mail/message.rb:230:in `deliver'
devise (1.3.4) lib/devise/models/confirmable.rb:50:in `send_confirmation_instructions'
activesupport (3.0.3) lib/active_support/callbacks.rb:425:in `_run_create_callbacks'
activerecord (3.0.3) lib/active_record/callbacks.rb:281:in `create'
activerecord (3.0.3) lib/active_record/persistence.rb:246:in `create_or_update'
activerecord (3.0.3) lib/active_record/callbacks.rb:277:in `create_or_update'
activesupport (3.0.3) lib/active_support/callbacks.rb:418:in `_run_save_callbacks'
activerecord (3.0.3) lib/active_record/callbacks.rb:277:in `create_or_update'
activerecord (3.0.3) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.3) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.3) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:289:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:204:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
activerecord (3.0.3) lib/active_record/transactions.rb:236:in `save'
devise (1.3.4) app/controllers/devise/registrations_controller.rb:16:in `create'
app/controllers/registrations_controller.rb:3:in `create'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:445:in `_run__799082383__process_action__1623385099__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `send'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `send'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:120:in `process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.3) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/mapper.rb:35:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:89:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/builder.rb:30:in `call'
warden (1.0.4) lib/warden/manager.rb:35:in `call'
warden (1.0.4) lib/warden/manager.rb:34:in `catch'
warden (1.0.4) lib/warden/manager.rb:34:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.2) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in `call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.2) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `send'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.2) lib/rack/content_length.rb:13:in `call'
rack (1.2.2) lib/rack/handler/webrick.rb:52:in `service'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.2) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.2) lib/rack/server.rb:213:in `start'
railties (3.0.3) lib/rails/commands/server.rb:65:in `start'
railties (3.0.3) lib/rails/commands.rb:30
railties (3.0.3) lib/rails/commands.rb:27:in `tap'
railties (3.0.3) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
请帮我解决这个问题!
String#encode!在Ruby 1.9中是新的,所以在1.8.7中没有。因此,您正在使用的邮件gem似乎依赖于1.9。