Browse Source

Use default filename when exporting one-off queries

Andrew Kane 8 years ago
parent
commit
c70c88ddbc
1 changed files with 1 additions and 1 deletions
  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