Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix migration 20230215085312_migrate_message_body_to_action_text fix … #1048

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading