0

我通过制作一个新的 rails 5.2 应用程序然后将所有应用程序文件传输到它,将 Ruby 2.4 上的 Rails 5.1.6 应用程序升级到 Ruby 2.5.1 上的 Rails 5.2。

我注意到以下变化:

  • 咖啡脚本停止工作(没问题,我刚改成js)
  • 创建新记录停止工作,但可以编辑现有记录。我只是得到下面的回滚错误:

    2.5.1 :005 > Item.create(name: "asdf") (0.3ms) BEGIN (0.8ms) ROLLBACK ..

Rails 5.2 中有什么会影响 Active Record 中的新记录吗?

4

1 回答 1

1

事实证明,optional: true必须为 Rails 5 中的每个 belongs_to 设置:

belongs_to :another_record, optional: true
于 2018-05-22T06:17:04.947 回答