您好我正在尝试使用refile gem
将图片直接上传到S3project.rb看起来像
class Project < ActiveRecord::Base
has_many :photos, :class_name => "Project::Photo", dependent: :destroy
accepts_attachments_for :photos
end
项目/ photo.rb
class Project::Photo < ActiveRecord::Base
belongs_to :project
attachment :file
attr_accessible :name, :address, :created_at, :project_id, :file
before_create :debugging_create
end
配置/初始化/ refile.rb
require "refile/s3"
aws = {
access_key_id: "xyz",
secret_access_key: "abc",
region: "sa-east-1",
bucket: "my-bucket",
}
Refile.cache = Refile::S3.new(prefix: "cache", **aws)
Refile.store = Refile::S3.new(prefix: "store", **aws)
Refile.backends的输出[图片1]
文件上传的参数对于photos_files [图片2]
是这样的的问题: