We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 6.1中,对active storage,在模型中增加了service新的配置方法,例如:
# models/user.rb has_one_attached :avatar, service: :aliyun
development.rb中,未做修改,保持了默认
# config/environments/development.rb config.active_storage.service = :local
非direct_upload文件时,可以正常上传到阿里云oss
<%= form.file_field :avatar %>
使用direct_upload传文件时,依然上传到本地,而不是阿里云oss上。也就说模型中配置的service,根本没有生效。
<%= form.file_field :avatar, direct_upload: true %>
chrome的netwok中,看不到请求阿里云oss的记录。
模型中,不配置service
# models/user.rb has_one_attached :avatar
development.rb中,修改为:aliyun
# config/environments/development.rb config.active_storage.service = :aliyun
再次测试direct_upload文件,可以正确上传到阿里云oss了。 chrome的netwok中,也可以看到请求阿里云oss的记录。
初步判断,
我不确定是Rails的问题,还是activestorage-aliyun的问题?
The text was updated successfully, but these errors were encountered:
#71
我在测试里面试了一下,没重现出来
Sorry, something went wrong.
cd test/dummy rails s
提示错误:
发现avatar上传成功,files的上传全部失败。
发现tmp/storage目录下,出现了direct_upload上传的files文件。说明has_many_attached :files, service: :aliyun未生效,依然传到:local中了
has_many_attached :files, service: :aliyun
:local
目前看来,问题出在Rails本身上了
rails/rails#34935 (comment)
rails/rails#38957
No branches or pull requests
操作一
Rails 6.1中,对active storage,在模型中增加了service新的配置方法,例如:
development.rb中,未做修改,保持了默认
非direct_upload文件时,可以正常上传到阿里云oss
使用direct_upload传文件时,依然上传到本地,而不是阿里云oss上。也就说模型中配置的service,根本没有生效。
chrome的netwok中,看不到请求阿里云oss的记录。
操作二
模型中,不配置service
development.rb中,修改为:aliyun
再次测试direct_upload文件,可以正确上传到阿里云oss了。
chrome的netwok中,也可以看到请求阿里云oss的记录。
结论:
初步判断,
我不确定是Rails的问题,还是activestorage-aliyun的问题?
The text was updated successfully, but these errors were encountered: