Skip to content
Snippets Groups Projects
Unverified Commit 660228f7 authored by Arnaud Levy's avatar Arnaud Levy Committed by GitHub
Browse files

Fix missing images (#2237)

parent c3f24995
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,8 @@ class Communication::Website::Post::Category < ApplicationRecord
include WithTree
include WithUniversity
has_one_attached_deletable :featured_image # TODO L10N remove
belongs_to :parent,
class_name: 'Communication::Website::Post::Category',
optional: true
......
......@@ -8,6 +8,19 @@ namespace :app do
desc 'Fix things'
task fix: :environment do
Communication::Website::Post::Category.find_each do |category|
next unless category.featured_image.attached?
puts '---'
puts category.localizations.first.to_s
category.localizations.each do |l10n|
puts l10n
l10n.featured_image.attach(
io: URI.open(category.featured_image.url),
filename: category.featured_image.filename.to_s,
content_type: category.featured_image.content_type
)
end
end
end
namespace :websites do
......
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