【问题标题】:Breaking Cloudinary after Rails 6.1 upgradeRails 6.1 升级后打破 Cloudinary
【发布时间】:2021-01-07 14:07:07
【问题描述】:

我升级到 Rails 6.1,这破坏了我的 Cloudinary。

每当我去一个附有照片的实例时,我现在都会得到这个:

undefined method `service_name' for #<ActiveStorage::Blob:0x00007fb4b1c6de88>
Did you mean?  service

知道怎么解决吗?

【问题讨论】:

  • 您能否向我们展示更多在您的应用中定义service_name 的代码?

标签: ruby-on-rails-6 cloudinary


【解决方案1】:

运行rails active_storage:update 解决了我的问题。

我已经运行了rails app:update,它创建了以下迁移:AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId

但是在运行 rails active_storage:update 之后,我得到了两个额外的迁移:

AddServiceNameToActiveStorageBlobs & CreateActiveStorageVariantRecords.

【讨论】:

    【解决方案2】:

    我认为这与另一个 SO topic 中的问题类似。

    接受的答案是运行

    rails active_storage:update
    rails db:migrate
    

    【讨论】:

      猜你喜欢
      • 2021-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-14
      • 2017-01-29
      • 1970-01-01
      • 2021-07-05
      • 1970-01-01
      相关资源
      最近更新 更多