我正在使用Omniauth gem通过我的网站在Ruby on Rails中通过谷歌登录。我正在使用Omnicontacts gem获取联系人。如果没有当前用户,并且未授权我们网站的新用户尝试登录,则会收到以下错误。
TypeError (no implicit conversion of String into Integer):
omnicontacts (0.3.4) lib/omnicontacts/importer/gmail.rb:64:in `[]'
omnicontacts (0.3.4) lib/omnicontacts/importer/gmail.rb:64:in `block in contacts_from_response'
omnicontacts (0.3.4) lib/omnicontacts/importer/gmail.rb:41:in `each'
omnicontacts (0.3.4) lib/omnicontacts/importer/gmail.rb:41:in `contacts_from_response'
omnicontacts (0.3.4) lib/omnicontacts/importer/gmail.rb:24:in `fetch_contacts_using_access_token'
omnicontacts (0.3.4) lib/omnicontacts/middleware/oauth2.rb:52:in `fetch_contacts'
omnicontacts (0.3.4) lib/omnicontacts/middleware/base_oauth.rb:66:in `block in handle_callback'
omnicontacts (0.3.4) lib/omnicontacts/middleware/base_oauth.rb:76:in `execute_and_rescue_exceptions'
omnicontacts (0.3.4) lib/omnicontacts/middleware/base_oauth.rb:62:in `handle_callback'
omnicontacts (0.3.4) lib/omnicontacts/middleware/base_oauth.rb:39:in `call'
omnicontacts (0.3.4) lib/omnicontacts/builder.rb:27: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.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.1.1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.1) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.1) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.1) lib/rails/engine.rb:514:in `call'
railties (4.1.1) lib/rails/application.rb:144:in `call'
passenger (4.0.46) lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
passenger (4.0.46) lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
passenger (4.0.46) lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
passenger (4.0.46) lib/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads'
答案 0 :(得分:0)
这是omnicontacts gem中的一个已知问题。请参阅此网址https://github.com/Diego81/omnicontacts/issues/71。解决方案也在那里。