redmine_glossary/app/views/glossary_terms/index.csv.ruby

20 lines
488 B
Plaintext
Raw Permalink Normal View History

2019-12-07 19:05:44 +01:00
require 'csv'
CSV.generate(row_sep: "\r\n", encoding: "CP932") do |csv|
column_names = ["name", "name_en", "category", "datatype", "codename", "description", "rubi", "abbr_whole"]
csv << column_names
@glossary_terms.each do |term|
column_values = [
term.name,
term.name_en,
term.category&.name,
term.datatype,
term.codename,
term.description,
term.rubi,
term.abbr_whole
]
csv << column_values
end
end