I've updated config/initializers/mime_types.rb and restarted the server.
Mime::Type.register "application/vnd.sealed-xls", :xls
My controller looks like this:
respond_to do |format|
format.xls { send_file(file_name, filename: "dagsrapport.xls") }
format.html
end
This is the error I get when I do a GET on /sheet.xls
To respond to a custom format, register it as a MIME type first:
http://guides.rubyonrails.org/action_controller_overview.html#restful-downloads. If you meant to
respond to a variant like :tablet or :phone, not a custom format, be sure to nest your variant
response within a format response: format.html { |html| html.tablet { ... } }
Any tips to what I'm missing? I can't see what I'm doing wrong according to the doc: http://guides.rubyonrails.org/action_controller_overview.html#restful-downloads
All I did to register xls as Mime type - just added to config/initializers/mime_types.rb Mime::Type.register "application/xls", :xls
and restarted the server. Hope it'll help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With