With Rails version 5.2.rc1
if I use
respond_to do |format|
format.csv { render(csv: "test") }
end
results
ActionController::UnknownFormat
What is the best way to export to csv in rails 5?
Please look into the Railscast's screencast. If you followed everything properly and still you're getting the error, then try something like this in your routes:
match '/yourPathTo.csv' => 'controller#action', via: :get, defaults: { format: :csv }