I have a project where I import a csv. One of the columns in the CSV is a remote_image_url.
When a user imports the CSV, I want to fetch all the remote images and add them to our project.
def self.import(file)
CSV.foreach(file.path, headers: true) do |row|
Deal.delay.create! row.to_hash
end
end
def image_remote_url=(url_value)
self.image = URI.parse(url_value)
@image_remote_url = url_value
end
If I remove delay from Deal.create!, it works fine. However when I run it with the delayed_job, it does properly extract the image filename and put it in the correct paperclip column, but it does not actually perform the upload.
Iām confused as to where to add instructions to make this work properly.
Iāve just built a quick Rails app to try to duplicate your problem, but everything worked fine for me (hereās my minimal model). I was using Paperclip 3.4.2 with the default filesystem storage backend and Delayed::Job 3.0.5.
What Paperclip storage backend are you using?
Also, have you tried running an isolated test that only sets an image_remote_url and does nothing else? Something like this: