Skip to content
Snippets Groups Projects
Commit 4b6168a9 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

refactor

parent d947cf41
No related branches found
No related tags found
No related merge requests found
......@@ -7,14 +7,13 @@ class BlocksMigration
Communication::Website::Post.find_each do |post|
next if post.text.blank?
puts "#{post} (#{post.id}, #{post.university})"
if post.blocks.none?
puts " migrating"
block = post.blocks.create university: post.university, template_kind: :chapter
data = block.data
data['text'] = post.text.to_html
block.data = data
block.save
end
next if post.blocks.any?
puts " migrating"
block = post.blocks.create university: post.university, template_kind: :chapter
data = block.data
data['text'] = post.text.to_html
block.data = data
block.save
end
end
end
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