ActionView::Template::Error: undefined method `is_admin' for nil:NilClass

ActionView::Template::Error: undefined method `is_admin' for nil:NilClass

我正在使用 ruby 2.2/Rails 4.2 和 Heroku 上的活动记录。我只在我的 heroku 生产服务器上收到此错误。在我的开发机器上一切正常。 is_admin 是我添加到我的 Devise 用户 table 的布尔字段,并在登录用户尝试加载管理部分中的页面时检查。如果他们不是管理员,他们将被踢到主应用程序页面。奇怪的是,它是出现此错误的登录页面,并且 is_admin 不应该被调用,除非 a) 用户已登录(我没有登录)和 b) 用户试图加载管理页面(我没有)。

我根据另一个线程中的一些建议安装了 delayed_jobs。我成功了(我认为,它至少不会使我的开发服务器崩溃),但我仍然遇到相同的 undefined_method 错误。

May 08 06:45:25 myappname heroku/router:  at=info method=GET path="/portal/users/sign_in" host=myappname.herokuapp.com request_id=946f39d1-7f07-4d52-a436-66c14c6734bc fwd="68.196.133.101" dyno=web.1 connect=2ms service=2943ms status=500 bytes=153 
May 08 06:45:25 myappname app/web.1:  2015-05-08 13:45:24 +0000: Rack app error: #<ActionView::Template::Error: undefined method `is_admin' for nil:NilClass> 
May 08 06:45:25 myappname app/web.1:  /app/app/views/layouts/application.html.erb:71:in `_app_views_layouts_application_html_erb___400859338153902421_70022501785140' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/template.rb:145:in `block in render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/template.rb:333:in `instrument' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/template.rb:143:in `render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/renderer/template_renderer.rb:52:in `render_template' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/renderer/template_renderer.rb:14:in `render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/renderer/renderer.rb:42:in `render_template' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/renderer/renderer.rb:23:in `render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/rendering.rb:100:in `_render_template' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/streaming.rb:217:in `_render_template' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/rendering.rb:83:in `render_to_body' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rendering.rb:32:in `render_to_body' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/renderers.rb:37:in `render_to_body' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/rendering.rb:25:in `render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rendering.rb:16:in `render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/core_ext/benchmark.rb:12:in `block in ms' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/benchmark.rb:303:in `realtime' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/core_ext/benchmark.rb:12:in `ms' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb:41:in `block in render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb:40:in `render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/implicit_render.rb:10:in `default_render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/responders-2.1.0/lib/action_controller/responder.rb:236:in `default_render' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/responders-2.1.0/lib/action_controller/responder.rb:170:in `to_html' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/responders-2.1.0/lib/action_controller/responder.rb:163:in `respond' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/responders-2.1.0/lib/action_controller/responder.rb:156:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/responders-2.1.0/lib/action_controller/respond_with.rb:203:in `respond_with' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/devise-3.4.1/app/controllers/devise/sessions_controller.rb:11:in `new' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb:198:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rendering.rb:10:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb:20:in `block in process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:234:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:234:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:234:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:234:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:169:in `block in halting' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in `_run_callbacks' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:734:in `_run_process_action_callbacks' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:81:in `run_callbacks' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb:19:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rescue.rb:29:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `block in instrument' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `instrument' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb:30:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb:137:in `process' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/rendering.rb:30:in `process' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal.rb:195:in `dispatch' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal.rb:236:in `block in action' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:73:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:42:in `serve' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:49:in `serve' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/journey/router.rb:43:in `block in serve' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/journey/router.rb:30:in `each' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/journey/router.rb:30:in `serve' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:802:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/etag.rb:24:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/conditionalget.rb:25:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/head.rb:13:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/flash.rb:260:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:225:in `context' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:220:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/cookies.rb:560:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/query_cache.rb:36:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:88:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:88:in `_run_callbacks' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:734:in `_run_call_callbacks' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:81:in `run_callbacks' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/remote_ip.rb:78:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb:38:in `call_app' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb:20:in `block in call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:68:in `block in tagged' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:26:in `tagged' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:68:in `tagged' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb:20:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/request_id.rb:21:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/runtime.rb:18:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/lock.rb:17:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/static.rb:113:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.1/lib/rack/sendfile.rb:113:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/engine.rb:518:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:164:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2/lib/puma/configuration.rb:51:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2/lib/puma/server.rb:507:in `handle_request' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2/lib/puma/server.rb:375:in `process_client' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2/lib/puma/server.rb:262:in `block in run' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2/lib/puma/thread_pool.rb:104:in `call' 
May 08 06:45:25 myappname app/web.1:  /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2/lib/puma/thread_pool.rb:104:in `block in spawn_thread' 

您可能在布局中调用 is_admin?。也许在边栏中,没有 current_user 登录。尝试添加:

if current_user && current_user.is_admin?

进行验证以确保在进行 is_admin? 验证之前有一个 current_user