我正在尝试使用 LDAP 身份验证配置 errbit,但出现以下错误:“nil:NilClass 的未定义方法 `each'”
def set_time_zone
Time.zone = current_user.time_zone if user_signed_in?
end
def authenticate_user_from_token!
这是完整的堆栈跟踪:
devise_ldap_authenticatable (0.8.6) lib/devise_ldap_authenticatable/ldap/connection.rb:206:in `has_required_attribute_presence?'
devise_ldap_authenticatable (0.8.6) lib/devise_ldap_authenticatable/ldap/connection.rb:114:in `authorized?'
devise_ldap_authenticatable (0.8.6) lib/devise_ldap_authenticatable/ldap/adapter.rb:15:in `valid_credentials?'
devise_ldap_authenticatable (0.8.6) lib/devise_ldap_authenticatable/model.rb:48:in `valid_ldap_authentication?'
devise_ldap_authenticatable (0.8.6) lib/devise_ldap_authenticatable/model.rb:105:in `find_for_ldap_authentication'
devise_ldap_authenticatable (0.8.6) lib/devise_ldap_authenticatable/strategy.rb:13:in `authenticate!'
warden (1.2.7) lib/warden/strategies/base.rb:54:in `_run!'
warden (1.2.7) lib/warden/proxy.rb:359:in `block in _run_strategies_for'
warden (1.2.7) lib/warden/proxy.rb:354:in `each'
warden (1.2.7) lib/warden/proxy.rb:354:in `_run_strategies_for'
warden (1.2.7) lib/warden/proxy.rb:324:in `_perform_authentication'
warden (1.2.7) lib/warden/proxy.rb:105:in `authenticate'
devise (4.7.1) lib/devise/controllers/helpers.rb:126:in `current_user'
devise (4.7.1) lib/devise/controllers/helpers.rb:122:in `user_signed_in?'
app/controllers/application_controller.rb:30:in `set_time_zone'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:432:in `block in make_lambda'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:164:in `block in halting'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:504:in `block in call'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:504:in `each'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:504:in `call'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.11.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.11.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.11.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.11.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.11.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.11.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.11.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.11.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
actionpack (4.2.11.1) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.11.1) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.11.1) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.11.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.11.1) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.11.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.11.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.11.1) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.11.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.11.1) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.11.1) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.11.1) lib/action_dispatch/routing/route_set.rb:817:in `call'
meta_request (0.6.0) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
meta_request (0.6.0) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/rack.rb:27:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (1.6.13) lib/rack/etag.rb:24:in `call'
rack (1.6.13) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.13) lib/rack/head.rb:13:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.13) lib/rack/session/abstract/id.rb:252:in `context'
rack (1.6.13) lib/rack/session/abstract/id.rb:247:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.11.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.11.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
better_errors (2.5.0) lib/better_errors/middleware.rb:59:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
rack-contrib (1.8.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.6.0) lib/meta_request/middlewares/headers.rb:16:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.11.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.11.1) lib/rails/rack/logger.rb:22:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
request_store (1.1.0) lib/request_store/middleware.rb:8:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.13) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.13) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.11.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.13) lib/rack/lock.rb:17:in `call'
actionpack (4.2.11.1) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.13) lib/rack/sendfile.rb:113:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/user_informer.rb:12:in `call'
railties (4.2.11.1) lib/rails/engine.rb:518:in `call'
railties (4.2.11.1) lib/rails/application.rb:165:in `call'
rack (1.6.13) lib/rack/deflater.rb:35:in `call'
puma (4.3.3) lib/puma/configuration.rb:228:in `call'
puma (4.3.3) lib/puma/server.rb:682:in `handle_request'
puma (4.3.3) lib/puma/server.rb:472:in `process_client'
puma (4.3.3) lib/puma/server.rb:328:in `block in run'
puma (4.3.3) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
有人可以帮我吗?