我正在尝试使用 Apartment(具体来说是 ros-apartment fork)在我的 Spree 商务应用程序(ruby 3.2.0、rails 7)中设置多租户。
当我上传文件时,它们会被添加到正确的租户架构中,我可以在 ActiveStorage::Blob 中看到它。但是当我尝试访问图像时,它只查看公共模式中的 ActiveStorage::Blob 而不是租户模式,最终抛出 404 错误 ->
ActiveRecord::RecordNotFound in ActiveStorage::Representations::ProxyController#show Couldn't find ActiveStorage::Blob with 'id'=1
我需要设置其他东西才能正常工作吗?
我已将 config.middleware.use Apartment::Elevators::Subdomain 添加到我的 application.rb 中。
感谢任何帮助,谢谢。
这是与 Rails 7 的兼容性问题。我切换到 Rails 6.1.2 并且它可以正常工作。
看起来公寓和 ros-apartment gems 不再维护了。
参考:https://github.com/rails-on-services/apartment/issues/234#issuecomment-1756833846