show.html.erb
<%= link_to "CSV", patient_record_path(format: "csv") %>
record_controller.rb
def show
@data_filtered = PatientData.new(:data => getDataFromURL)
respond_to do |format|
format.html
format.csv { send_data @data_filtered.to_csv }
end
end
patient_data.rb (model)
def self.to_csv
CSV.generate({}) do |csv|
csv << data.first.keys
data.each do |hash|
csv << hash.values
end
end
end
When I click the CSV link to export this I get the error. I have required 'csv' This is the guide I followed http://railscasts.com/episodes/362-exporting-csv-and-excel?view=asciicast
Template is missing
Missing template patient_record/show, application/show with {:locale=>[:en], :formats=>[:csv], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/Users/samantha.klonaris/RubymineProjects/intermediate_form_reader/app/views"