ruby-on-rails - Ruby on Rails:Fetch_values 回滚错误
问题描述
我已经将我的 Ruby 升级到 2.5,在纠正了许多依赖问题之后,我被困在了一个地方。调用了 save 方法来保存记录,但不知何故它现在不起作用并显示以下错误:
500 Internal Error
undefined method 'fetch_value' for #<Hash:0*0007e589e>
Did you mean fetch_values
each_value:
早些时候,同样.save
的工作非常好。
解决方案
I've seen the same exception before. In my case, some ActiveRecord models were marshaled via Marshal::dump
and saved as binary stream. Then, Ruby and Rails were upgraded.
Afterwards, calling Marshal::load
on the marshaled copies would retrieve them and object.class
would show the right model's name, but accessing any attribute within would throw the same exception.
I had to clear the marshaled copies and generate new ones.
推荐阅读
- azure - Azure devops 服务连接和中央管道
- asp.net-mvc - ThreeJS / GLTFLoader 以 404 响应我的 gltf 对象
- android - Android 项目导出到 Android Studio 时出现 Unity Gradle 错误
- javascript - 如何获取此 JSON 数组中的最后一个对象?
- java - Docker - Mac 上的“端口不可用”问题
- python - 使用 python (ctypes) 调用 C 函数时出现问题?
- django - 如何使用异步 Django RESTAPI 调用同时运行 docker 命令
- git - 从 Visual Studio Code (1.62.2) 推送到 GitHub 时出现“致命:身份验证失败”
- amazon-web-services - 将缺失的数据字段提取到 SageMaker Feature Store 的功能组中
- c# - 什么可能导致 MemoryCache 每 2 分钟驱逐所有条目?