Module: ExcelCSVExporter
- Defined in:
- lib/acts_as_csv.rb
Overview
module for extending ActionController
Constant Summary collapse
- BOM =
Byte Order Mark, Appease Excel Gods
"\377\376"
Instance Method Summary collapse
Instance Method Details
#send_csv(kollection, options = {}) ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/acts_as_csv.rb', line 102 def send_csv(kollection, ={}) filename = .delete(:filename) || I18n.l(Time.now, :format => :short) + ".csv" content = kollection.to_csv() # Appease Excel Gods content = BOM + Iconv.conv("utf-16le", "utf-8", content) send_data content, :filename => filename end |