首页 > 解决方案 > 初始页面加载时的 ActiveStorage::FileNotFoundError(有时)

问题描述

在我的 Rails 应用程序中,我遇到了一个关于主动存储的奇怪问题,错误显示:

ActiveStorage::FileNotFoundError ActiveStorage::Representations::RedirectController#show

并且这个 LoadError 被击中

raise LoadError, "Unable to autoload constant #{qualified_name}, expected #{file_path} to define it"

具体错误:

Unable to autoload constant ActiveStorage::Blobs::RedirectController, expected /Users/username/.rvm/gems/ruby-2.6.6/gems/activestorage-6.1.3/app/controllers/active_storage/blobs/redirect_controller.rb to define it

这种情况仅在某些时候发生,如果发生,页面刷新将使图像显示。发生这种情况时,图像不会加载并且似乎已损坏。我不能始终如一地重现这个,有什么想法吗?

红宝石 2.6.6p146 轨道 6.1.3

标签: ruby-on-railsrails-activestorage

解决方案


推荐阅读