add rich_text fields to backup and put main in container
This commit is contained in:
parent
b88ac28c9b
commit
be45f3454e
2 changed files with 12 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue