【发布时间】:2012-08-08 15:54:06
【问题描述】:
我有一个应用程序可以读取文件的内容并为其编制索引。我将它们存储在磁盘本身中,但现在我使用的是 Amazon S3,因此以下方法不再适用。
原来是这样的:
def perform(docId)
@document = Document.find(docId)
if @document.file?
#You should't create a new version
@document.versionless do |doc|
@document.file_content = Cloudoc::Extractor.new.extract(@document.file.file)
@document.save
end
end
end
@document.file 返回FileUploader,doc.file.file 返回CarrierWave::Storage::Fog::File 类。
我怎样才能得到真正的文件?
【问题讨论】:
标签: ruby ruby-on-rails-3 amazon-s3 carrierwave