Skip to content

Commit

Permalink
fix migration 20230215085312_migrate_message_body_to_action_text fix f…
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbauer committed Feb 21, 2024
1 parent f4a4528 commit 29db737
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ def change
dir.up do
rename_column :messages, :body, :body_old
Message.all.each do |message|
message.update(body: simple_format(message.body_old))
elem = Nokogiri::XML::DocumentFragment.parse(simple_format(message.body_old))
elem.content = elem.content.encode('ascii', fallback: ->(char) { "&##{char.ord};" })
message.update(body: elem)
message.body.update(record_type: :Message) # action_text_rich_texts uses STI record_type field and has to be set to the real model
end
remove_column :messages, :body_old, :text
Expand Down

0 comments on commit 29db737

Please sign in to comment.