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

with pages

parent 9134f285
No related branches found
No related tags found
No related merge requests found
...@@ -6,21 +6,26 @@ class BlocksMigration ...@@ -6,21 +6,26 @@ class BlocksMigration
def self.cleanup def self.cleanup
Communication::Website::Post.find_each do |post| Communication::Website::Post.find_each do |post|
next if post.text.blank? next if post.text.blank?
cleanup_post post cleanup_item post
end
Communication::Website::Page.find_each do |page|
next if page.text.blank?
cleanup_item page
end end
end end
private private
def self.cleanup_post(post) def self.cleanup_item(item)
puts "#{post} (#{post.id}, #{post.university})" puts "#{item} (#{item.id}, #{item.university}, #{item.website})"
return if post.blocks.any? return if item.blocks.any?
puts " migrating" puts " migrating"
puts post.text.to_html puts item.text.to_html
# block = post.blocks.create university: post.university, template_kind: :chapter return
# data = block.data block = item.blocks.create university: item.university, template_kind: :chapter
# data['text'] = post.text.to_html data = block.data
# block.data = data data['text'] = item.text.to_html
# block.save block.data = data
block.save
end 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