0

我正在尝试设置可确认的设计并使用 mailcatcher 进行测试。当我尝试注册时,我收到文件结尾错误,它指向注册控制器的创建操作。我正在使用cloud9。我用mailcatcher --http-port 8081 --ip $IP -f. 我用rails server -b $IP -p $PORT. 我的 development.rb 文件:

config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = "cloud9-url"
  config.action_mailer.default_url_options = { host: host }
  config.action_mailer.smtp_settings = { :address => host, :port => 8081 }

我的 devise.rb 文件中也有该行config.mailer_sender = 'noreply@example.com'

这是服务器日志:

Completed 500 Internal Server Error in 30854ms

EOFError (end of file reached):
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182:in `sysread_nonblock'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182:in `read_nonblock'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:945:in `recv_response'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:555:in `block in do_start'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:955:in `critical'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:555:in `do_start'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:520:in `start'
  mail (2.6.3) lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
  mail (2.6.3) lib/mail/message.rb:2141:in `do_delivery'
  mail (2.6.3) lib/mail/message.rb:236:in `block in deliver'
  actionmailer (4.1.7) lib/action_mailer/base.rb:527:in `block in deliver_mail'
  activesupport (4.1.7) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.7) lib/active_support/notifications.rb:159:in `instrument'
  actionmailer (4.1.7) lib/action_mailer/base.rb:525:in `deliver_mail'
  mail (2.6.3) lib/mail/message.rb:236:in `deliver'
  devise (3.5.2) lib/devise/models/authenticatable.rb:172:in `send_devise_notification'
  devise (3.5.2) lib/devise/models/confirmable.rb:116:in `send_confirmation_instructions'
  devise (3.5.2) lib/devise/models/confirmable.rb:172:in `send_on_create_confirmation_instructions'
  activesupport (4.1.7) lib/active_support/callbacks.rb:424:in `block in make_lambda'
  activesupport (4.1.7) lib/active_support/callbacks.rb:221:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:221:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `run_callbacks'
  activerecord (4.1.7) lib/active_record/callbacks.rb:306:in `_create_record'
  activerecord (4.1.7) lib/active_record/timestamp.rb:57:in `_create_record'
  activerecord (4.1.7) lib/active_record/persistence.rb:483:in `create_or_update'
  activerecord (4.1.7) lib/active_record/callbacks.rb:302:in `block in create_or_update'
  activesupport (4.1.7) lib/active_support/callbacks.rb:113:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:113:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `run_callbacks'
  activerecord (4.1.7) lib/active_record/callbacks.rb:302:in `create_or_update'
  activerecord (4.1.7) lib/active_record/persistence.rb:103:in `save'
  activerecord (4.1.7) lib/active_record/validations.rb:51:in `save'
  activerecord (4.1.7) lib/active_record/attribute_methods/dirty.rb:21:in `save'
  activerecord (4.1.7) lib/active_record/transactions.rb:268:in `block (2 levels) in save'
  activerecord (4.1.7) lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
  activerecord (4.1.7) lib/active_record/transactions.rb:208:in `transaction'
  activerecord (4.1.7) lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
  activerecord (4.1.7) lib/active_record/transactions.rb:268:in `block in save'
  activerecord (4.1.7) lib/active_record/transactions.rb:283:in `rollback_active_record_state!'
  activerecord (4.1.7) lib/active_record/transactions.rb:267:in `save'
  devise (3.5.2) app/controllers/devise/registrations_controller.rb:17:in `create'
  actionpack (4.1.7) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.1.7) lib/abstract_controller/base.rb:189:in `process_action'
  actionpack (4.1.7) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.1.7) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (4.1.7) lib/active_support/callbacks.rb:113:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:113:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:229:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:229:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:229:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:229:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.7) lib/active_support/callbacks.rb:149:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:149:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
  activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:86:in `run_callbacks'
  actionpack (4.1.7) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (4.1.7) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  activesupport (4.1.7) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.7) lib/active_support/notifications.rb:159:in `instrument'
  actionpack (4.1.7) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.1.7) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
  activerecord (4.1.7) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.1.7) lib/abstract_controller/base.rb:136:in `process'
  actionview (4.1.7) lib/action_view/rendering.rb:30:in `process'
  actionpack (4.1.7) lib/action_controller/metal.rb:196:in `dispatch'
  actionpack (4.1.7) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.1.7) lib/action_controller/metal.rb:232:in `block in action'
  actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:82:in `call'
  actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
  actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:50:in `call'
  actionpack (4.1.7) lib/action_dispatch/routing/mapper.rb:45:in `call'
  actionpack (4.1.7) lib/action_dispatch/journey/router.rb:73:in `block in call'
  actionpack (4.1.7) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.1.7) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.1.7) lib/action_dispatch/routing/route_set.rb:678:in `call'
  omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
  omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
  newrelic_rpm (3.6.7.152) lib/new_relic/rack/error_collector.rb:43:in `call'
  newrelic_rpm (3.6.7.152) lib/new_relic/rack/agent_hooks.rb:22:in `call'
  newrelic_rpm (3.6.7.152) lib/new_relic/rack/browser_monitoring.rb:16:in `call'
  newrelic_rpm (3.6.7.152) lib/new_relic/rack/developer_mode.rb:28:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  rack (1.5.5) lib/rack/etag.rb:23:in `call'
  rack (1.5.5) lib/rack/conditionalget.rb:35:in `call'
  rack (1.5.5) lib/rack/head.rb:11:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/flash.rb:254:in `call'
  rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  activerecord (4.1.7) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:82:in `run_callbacks'
  actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.7) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.7) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.7) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.5) lib/rack/runtime.rb:17:in `call'
  activesupport (4.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.5) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/static.rb:84:in `call'
  rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.7) lib/rails/engine.rb:514:in `call'
  railties (4.1.7) lib/rails/application.rb:144:in `call'
  rack (1.5.5) lib/rack/lock.rb:17:in `call'
  rack (1.5.5) lib/rack/content_length.rb:14:in `call'
  rack (1.5.5) lib/rack/handler/webrick.rb:60:in `service'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered /usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.8ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.7ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.3ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-4.1.7/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (29.7ms)

当我不使用 mailcatcher 时,一切似乎都正常,这意味着在我对 development.rb 文件进行了这些更改之后:

config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :test
  host = 'cloud9-url'
  config.action_mailer.default_url_options = { host: host }

然后我运行服务器并注册,我不再收到任何错误。

编辑:如果 cloud9 是 https,这是否意味着我需要更改 development.rb 文件中的任何内容?

4

0 回答 0