ruby-on-rails – 将Rails 3.2升级到Rails 4.2获取401未授权

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 将Rails 3.2升级到Rails 4.2获取401未授权前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我从轨道3.2更新到轨道4.2时,宝石全部兼容轨道4与 this交叉检查
当我运行服务器时,它会抛出如下错误.
Processing by HomeController#index as HTML
Completed 500 Internal Server Error in 28ms (ActiveRecord: 0.0ms)

TypeError (incompatible marshal file format (can't be read)
    format version 4.8 required; 123.34 given):
  activesupport (4.2.4) lib/active_support/core_ext/marshal.rb:6:in `load'
  activesupport (4.2.4) lib/active_support/core_ext/marshal.rb:6:in `load_with_autoloading'
  actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:424:in `deserialize'
  actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:516:in `[]'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/cookie_store.rb:114:in `get_cookie'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/cookie_store.rb:90:in `block in unpacked_cookie_data'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `stale_session_check!'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/cookie_store.rb:89:in `unpacked_cookie_data'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/cookie_store.rb:83:in `block in extract_session_id'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `stale_session_check!'
  actionpack (4.2.4) lib/action_dispatch/middleware/session/cookie_store.rb:82:in `extract_session_id'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:49:in `block in []'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:48:in `fetch'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:48:in `[]'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:70:in `id'
  rack (1.6.4) lib/rack/session/abstract/id.rb:282:in `current_session_id'
  rack (1.6.4) lib/rack/session/abstract/id.rb:288:in `session_exists?'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:152:in `exists?'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:172:in `load_for_read!'
  actionpack (4.2.4) lib/action_dispatch/request/session.rb:89:in `[]'
  warden (1.2.3) lib/warden/session_serializer.rb:30:in `fetch'
  warden (1.2.3) lib/warden/proxy.rb:212:in `user'
  warden (1.2.3) lib/warden/proxy.rb:318:in `_perform_authentication'
  warden (1.2.3) lib/warden/proxy.rb:104:in `authenticate'
  devise (3.5.2) lib/devise/controllers/helpers.rb:120:in `current_user'
  activesupport (4.2.4) lib/active_support/callbacks.rb:432:in `block in make_lambda'
  activesupport (4.2.4) lib/active_support/callbacks.rb:290:in `call'
  activesupport (4.2.4) lib/active_support/callbacks.rb:290:in `block (2 levels) in halting_and_conditional'
  activesupport (4.2.4) lib/active_support/callbacks.rb:290:in `each'
  activesupport (4.2.4) lib/active_support/callbacks.rb:290:in `all?'
  activesupport (4.2.4) lib/active_support/callbacks.rb:290:in `block in halting_and_conditional'
  activesupport (4.2.4) lib/active_support/callbacks.rb:497:in `call'
  activesupport (4.2.4) lib/active_support/callbacks.rb:497:in `block in around'
  activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
  activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
  activesupport (4.2.4) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
  activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
  activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (4.2.4) lib/action_controller/Metal/rescue.rb:29:in `process_action'
  actionpack (4.2.4) lib/action_controller/Metal/instrumentation.rb:32:in `block in process_action'
  activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
  actionpack (4.2.4) lib/action_controller/Metal/instrumentation.rb:30:in `process_action'
  actionpack (4.2.4) lib/action_controller/Metal/params_wrapper.rb:250:in `process_action'
  activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.2.4) lib/abstract_controller/base.rb:137:in `process'
  actionview (4.2.4) lib/action_view/rendering.rb:30:in `process'
  actionpack (4.2.4) lib/action_controller/Metal.rb:196:in `dispatch'
  actionpack (4.2.4) lib/action_controller/Metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.2.4) lib/action_controller/Metal.rb:237:in `block in action'
  actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `call'
  actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
  actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in `serve'
  actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in `block in serve'
  actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `each'
  actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `serve'
  actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in `call'
  client_side_validations (3.2.7) lib/client_side_validations/middleware.rb:17: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.6.4) lib/rack/etag.rb:24:in `call'
  rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
  rack (1.6.4) lib/rack/head.rb:13:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in `call'
  rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  activerecord (4.2.4) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
  activerecord (4.2.4) lib/active_record/migration.rb:377:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.2.4) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
  activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
  activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.4) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.4) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.4) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.4) lib/rails/engine.rb:518:in `call'
  railties (4.2.4) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  thin (1.6.4) lib/thin/connection.rb:86:in `block in pre_process'
  thin (1.6.4) lib/thin/connection.rb:84:in `catch'
  thin (1.6.4) lib/thin/connection.rb:84:in `pre_process'
  thin (1.6.4) lib/thin/connection.rb:53:in `process'
  thin (1.6.4) lib/thin/connection.rb:39:in `receive_data'
  eventmachine (1.0.8) lib/eventmachine.rb:193:in `run_machine'
  eventmachine (1.0.8) lib/eventmachine.rb:193:in `run'
  thin (1.6.4) lib/thin/backends/base.rb:73:in `start'
  thin (1.6.4) lib/thin/server.rb:162:in `start'
  rack (1.6.4) lib/rack/handler/thin.rb:19:in `run'
  rack (1.6.4) lib/rack/server.rb:286:in `start'
  railties (4.2.4) lib/rails/commands/server.rb:80:in `start'
  railties (4.2.4) lib/rails/commands/commands_tasks.rb:80:in `block in server'
  railties (4.2.4) lib/rails/commands/commands_tasks.rb:75:in `tap'
  railties (4.2.4) lib/rails/commands/commands_tasks.rb:75:in `server'
  railties (4.2.4) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  railties (4.2.4) lib/rails/commands.rb:17:in `<top (required)>'
  bin/rails:4:in `require'
  bin/rails:4:in `<main>'

是否缺少cookie或会话设置或设计所需的任何更改?

我也面临着不同的问题
Rails 4 upgrade JSON::ParseError for old sessions

Ruby on Rails TypeError

但没有运气我改变了秘密令牌.

解决方法

它似乎是校验和验证错误.而在callstack中,它就在CookieStore中间件之后.我试试以下内容

>在我的网络浏览器中清空cookie和缓存>如果使用服务器端cookie存储:清空其存储空间(例如:使用activerecord-session_store时清空会话数据库表)>使用rake tmp:clear清除my_app / tmp目录的内容

原文链接:https://www.f2er.com/ruby/265143.html

猜你在找的Ruby相关文章