我的项目中有以下文件。
config/storage.yml
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
google:
service: GCS
credentials: <%= Rails.root.join("google-cloud-storage-credentials.json") %>
project: "<%= ENV["GOOGLE_CLOUD_STORAGE_PROJECT_ID"] %>"
bucket: "matomeishi"
config/environments/development.rb
Rails.application.configure do
...
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :google
配置/环境/生产.rb
Rails.application.configure do
...
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :google
由于某种原因,尝试附加文件时,出现以下错误。
StandardError: Missing configuration for the local Active Storage service.
Configurations available for the test and google services..
看来应用程序没有考虑我的
config.active_storage.service
...
有人遇到同样的问题吗?这是一个错误吗?
谢谢!
添加到本地环境的
config/storage.yml
配置
例如:
local:
service: Disk
root: <%= Rails.root.join("storage") %>