我正在尝试遵循这个教程https://gorails.com/forum/direct-file-uploads-to-s3-part-2-example-gorails,在加载我的本地服务器时,它显示以下错误:
routing/mapper.rb:613:in `mount': A rack application must be specified (ArgumentError)以下是我的路线:
Rails.application.routes.draw do
root to: "photos#index"
resources :photos
mount ImageUploader::UploadEndpoint, at: "/images/upload"
end如果有人需要它,我的shrine.rb初始化器
require "shrine/storage/s3"
s3_options = {
access_key_id: "MY_ACCESS_KEY",
secret_access_key: "MY_SECRET_KEY",
region: "S3_REGION",
bucket: "S3_BUCKET",
}
Shrine.storages = {
cache: Shrine::Storage::S3.new(prefix: "cache", **s3_options),
store: Shrine::Storage::S3.new(prefix: "store", **s3_options),
}
Shrine.plugin :activerecord
Shrine.plugin :upload_endpoint
Shrine.plugin :presign_endpoint
Shrine.plugin :restore_cached_data任何和所有的帮助都将非常感谢!
发布于 2019-10-29 23:32:17
Shrine::UploadEndpoint类是一个使用旧的direct_upload插件的机架应用程序。使用upload_endpoint插件,您现在可以调用Shrine.upload_endpoint方法为选定的存储创建机架应用程序:
mount ImageUploader.upload_endpoint(:cache), at: "/images/upload"https://stackoverflow.com/questions/58610398
复制相似问题