5

我真的只是不确定这意味着什么或我应该做什么才能让网页在我的本地主机上运行。现在它只是显示一个错误,上面写着“我们很抱歉,但出了点问题。” 当我在 chrome 中运行rails server并打开时。localhost:3000

这是控制台输出:

    Started GET "/users/sign_in" for 127.0.0.1 at 2013-07-05 12:07:07 -0400
Processing by Devise::SessionsController#new as HTML
Completed 500 Internal Server Error in 55ms

NoMethodError (undefined method `empty?' for nil:NilClass):
  actionpack (3.2.11) lib/action_view/lookup_context.rb:145:in `detail_args_for'
  actionpack (3.2.11) lib/action_view/lookup_context.rb:139:in `args_for_lookup'
  actionpack (3.2.11) lib/action_view/lookup_context.rb:109:in `find'
  actionpack (3.2.11) lib/action_view/renderer/abstract_renderer.rb:3:in `find_template'
  actionpack (3.2.11) lib/action_view/renderer/template_renderer.rb:34:in `determine_template'
  newrelic_rpm (3.5.5.38) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:153:in `render_with_newrelic'
  actionpack (3.2.11) lib/action_view/renderer/renderer.rb:36:in `render_template'
  actionpack (3.2.11) lib/action_view/renderer/renderer.rb:17:in `render'
  actionpack (3.2.11) lib/abstract_controller/rendering.rb:110:in `_render_template'
  actionpack (3.2.11) lib/action_controller/metal/streaming.rb:225:in `_render_template'
  actionpack (3.2.11) lib/abstract_controller/rendering.rb:103:in `render_to_body'
  actionpack (3.2.11) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
  actionpack (3.2.11) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
  actionpack (3.2.11) lib/abstract_controller/rendering.rb:88:in `render'
  actionpack (3.2.11) lib/action_controller/metal/rendering.rb:16:in `render'
  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
  activesupport (3.2.11) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
  /Users/Alex/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
  activesupport (3.2.11) lib/active_support/core_ext/benchmark.rb:5:in `ms'
  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
  activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:39:in `render'
  remotipart (1.0.5) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
  actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
  actionpack (3.2.11) lib/action_controller/metal/responder.rb:232:in `default_render'
  actionpack (3.2.11) lib/action_controller/metal/responder.rb:160:in `to_html'
  actionpack (3.2.11) lib/action_controller/metal/responder.rb:153:in `respond'
  actionpack (3.2.11) lib/action_controller/metal/responder.rb:146:in `call'
  actionpack (3.2.11) lib/action_controller/metal/mime_responds.rb:239:in `respond_with'
  devise (2.2.3) app/controllers/devise/sessions_controller.rb:10:in `new'
  actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.11) lib/active_support/callbacks.rb:447:in `_run__4160102059982529417__process_action__1687296135628327387__callbacks'
  activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.11) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.11) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.11) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.11) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  newrelic_rpm (3.5.5.38) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
  newrelic_rpm (3.5.5.38) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
  newrelic_rpm (3.5.5.38) lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
  newrelic_rpm (3.5.5.38) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
  newrelic_rpm (3.5.5.38) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
  actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.11) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.11) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.11) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:36:in `call'
  actionpack (3.2.11) lib/action_dispatch/routing/mapper.rb:42:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call'
  rack-pjax (0.7.0) lib/rack/pjax.rb:12:in `call'
  newrelic_rpm (3.5.5.38) lib/new_relic/rack/error_collector.rb:8:in `call'
  newrelic_rpm (3.5.5.38) lib/new_relic/rack/browser_monitoring.rb:12:in `call'
  newrelic_rpm (3.5.5.38) lib/new_relic/rack/developer_mode.rb:24:in `call'
  warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.1) lib/warden/manager.rb:34:in `catch'
  warden (1.2.1) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call'
  remotipart (1.0.5) lib/remotipart/middleware.rb:30:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `_run__1343605869620971269__call__1397566206717956287__callbacks'
  activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.11) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.11) lib/rails/engine.rb:479:in `call'
  railties (3.2.11) lib/rails/application.rb:223:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.11) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
  /Users/Alex/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /Users/Alex/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /Users/Alex/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
4

3 回答 3

11

其他答案一般都是正确的。这个异常特别是由旧版本的 newrelic_rpm gem 和 Ruby 2.0 之间的不兼容引起的。请参阅导轨 #8885

更新 newrelic_rpm gem,它应该会消失。

于 2013-11-26T17:09:46.183 回答
0

您正在调用.empty?一个尚未在您的detail_args_for方法中某处初始化的变量。.nil?在检查.empty?是否要允许 Nil 值之前,可能会添加一个额外的调用:

if(!someVar.nil? && someVar.empty?)
于 2013-07-05T16:14:04.623 回答
0

这是您方法中的空引用异常detail_args_for(从技术上讲,它是 Nil 引用异常)。您试图empty?在具有 Nil 值的变量上调用该方法,这会导致问题,因为它没有在 nil 中定义

于 2013-07-05T16:13:13.090 回答