add rich_text fields to backup and put main in container
Some checks failed
/ Run tests (push) Successful in 1m22s
/ Run system tests (push) Failing after 1m36s
/ Build, push and deploy image (push) Successful in 1m22s

This commit is contained in:
david 2024-09-23 00:55:45 +02:00
parent b88ac28c9b
commit be45f3454e
2 changed files with 12 additions and 7 deletions

View file

@ -17,9 +17,12 @@ module Admin
next unless klass
workbook.add_worksheet(name: table) do |sheet|
sheet << klass.attribute_names
attributes = klass.attribute_names
attributes += klass.rich_text_association_names if klass.respond_to?(:rich_text_association_names)
sheet << attributes.map { _1.to_s.sub("rich_text_", "") }
klass.find_each do |record|
sheet << record.attributes.values
sheet << attributes.map { _1.starts_with?("rich_text") ? record.send(_1.to_s.sub("rich_text_", "")).body&.to_html : record.send(_1) }
end
end
end