您好我在我的应用程序中正常设置了Paperclip和S3用于图片上传,这是我用于附件的模型:
class Picture < ActiveRecord::Base
belongs_to :ofert, dependent: :destroy
has_attached_file :image, :styles => { :medium => "300x300#", :thumb => "100x100>", :large => "600x400#", :morethumb => "50x50#", :ultrathumb => "25x25#" },
:default_url => "https://s3-sa-east-1.amazonaws.com/:s3_bucket/ofert_defaults/:style/brown_hat.jpg"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
validates_attachment_presence :image, :if => :isProduction?
validates_attachment_size :image, :less_than => 5.megabytes
#process_in_background :image, processing_image_url: 'https://s3-sa-east-1.amazonaws.com/:s3_bucket/ofert_defaults/:style/brown_hat.jpg'
end
但是,当我试图去拍照时,上面的效果非常好:
picture.destroy
我收到以下错误:stack level too deep
但如果相反,我会做以下事情:
picture.delete
它有效,但上面只删除了记录但没有删除上传到我的S3存储桶的文件,不知道吗?