ruby on rails - Adding a Key to csv erb template output -


currently in create.csv.erb template have this.

<%- event_headers = @event_filters -%>

<%= csv.generate_line(event_headers) %>

it generates csv file

event1,event2,event3,event4

i add sort of key or header, output looks this

events: event1,event2,event3,event4

or this

events:  event1,event2,event3,event4 

is possible?

use string interpolation construct string wish have :)

<%= "events: #{csv.generate_line(event_headers)}" %> 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -