Ruby on Rails - 不兼容的 marshal 文件格式 [英] Ruby on Rails - incompatible marshal file format
问题描述
我最近将 Rails v3.x 应用程序升级到 Rails 4.1.1,大部分情况似乎都在转换,但是当我在 apache 配置文件中将应用程序从生产切换到开发时,我收到错误消息 我们很抱歉,但出了点问题
我知道开发环境正在运行,因为我可以在 development.log
文件中看到正在处理的 GET 请求.但在 GET 请求后不久,我在日志中得到以下内容
I recently upgraded a Rails v3.x app to Rails 4.1.1 and everything seemed to transition for the most part, but however when I switch the app from production to development in the apache config file, I get the error message We're sorry but something went wrong
I know the development environment is working because I can see the GET request being processed in the development.log
file. But shortly after the GET request I get the following in the log
ActionView::Template::Error(不兼容的 marshal 文件格式(无法读取)需要格式 4.8 版;123.34 给出):
推荐答案
就我而言,这个错误是由我在 config\initializers\cookies_serializer 中使用新的
.cookies_serializer
选项引起的.rb
In my case, this error was caused by me playing with the new cookies_serializer
option in config\initializers\cookies_serializer.rb
.
在开发中,我将其设置为 :json
(这意味着我的本地 cookie 被序列化为 json),但随后我完全删除了该选项并将其投入生产.如果我再次在开发中运行服务器,我的 json 序列化 cookie 会导致相同的错误.
In development I set it to :json
(which meant that my local cookies were serialized as json) but then I removed the option completely and put it in production. If I then ran the server in development again my json serialized cookies resulted in the same error.
因此,如果您曾经将 cookies_serializer
设置为 :hybrid
或 :json
运行,那么您将需要继续运行 (at最少) :hybrid
.
So if you have ever run with cookies_serializer
set to :hybrid
or :json
then you will need to carry on running with (at least) :hybrid
.
这篇关于Ruby on Rails - 不兼容的 marshal 文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!