7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/jobs/pageflow/upload_file_to_s3_job.rb', line 7
def self.perform_with_result(file, options)
if file && file.attachment_on_filesystem.file?
if File.exists?(file.attachment_on_filesystem.path)
file.attachment_on_s3 = file.attachment_on_filesystem
file.save!
file.attachment_on_filesystem.destroy
:ok
else
logger.info "#{file.class.name} #{file.id} not yet transfered to instance."
:pending
end
else
logger.warn "#{file.class.name} #{file.id} does not have an attachment on the file system. ignoring."
:error
end
end
|