首页 > 解决方案 > 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的工作非常好。

标签: ruby-on-railsruby

解决方案


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.


推荐阅读