Skip to content
Snippets Groups Projects
Unverified Commit 519e2649 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

fix

parent 48515ba0
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,5 @@ class Communication::Website::Imported::Medium < ApplicationRecord
def load_remote_file!
download_service = DownloadService.download(file_url)
file.attach(download_service.attachable_data)
save
end
end
......@@ -93,7 +93,10 @@ class Communication::Website::Imported::Page < ApplicationRecord
page.published = true
page.save
if featured_medium.present?
featured_medium.load_remote_file!
unless featured_medium.file.attached?
featured_medium.load_remote_file!
featured_medium.save
end
page.featured_image.attach(
io: URI.open(featured_medium.file.blob.url),
filename: featured_medium.file.blob.filename,
......
......@@ -95,7 +95,10 @@ class Communication::Website::Imported::Post < ApplicationRecord
post.published = true
post.save
if featured_medium.present?
featured_medium.load_remote_file!
unless featured_medium.file.attached?
featured_medium.load_remote_file!
featured_medium.save
end
post.featured_image.attach(
io: URI.open(featured_medium.file.blob.url),
filename: featured_medium.file.blob.filename,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment