Explorar o código

Use default filename when exporting one-off queries

Andrew Kane %!s(int64=8) %!d(string=hai) anos
pai
achega
c70c88ddbc
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      app/controllers/blazer/queries_controller.rb

+ 1 - 1
app/controllers/blazer/queries_controller.rb

@@ -138,7 +138,7 @@ module Blazer
           render layout: false
         end
         format.csv do
-          send_data csv_data(@rows), type: "text/csv; charset=utf-8; header=present", disposition: "attachment; filename=\"#{@query ? @query.name.parameterize : 'query'}.csv\""
+          send_data csv_data(@rows), type: "text/csv; charset=utf-8; header=present", disposition: "attachment; filename=\"#{@query.try(:name).try(:parameterize).presence || 'query'}.csv\""
         end
       end
     end