Class: Railspress::Admin::ExportsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Railspress::Admin::ExportsController
- Defined in:
- app/controllers/railspress/admin/exports_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/railspress/admin/exports_controller.rb', line 14 def create export = Export.create!( export_type: export_params[:export_type], status: "pending" ) ExportPostsJob.perform_later(export.id) redirect_to typed_admin_exports_path(type: export_params[:export_type]), notice: "Export started. You'll be able to download the file once processing completes." end |
#download ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/railspress/admin/exports_controller.rb', line 26 def download if @export.file.attached? send_data @export.file.download, filename: @export.filename, type: "application/zip", disposition: "attachment" else redirect_to typed_admin_exports_path(type: @export.export_type), alert: "Export file not available." end end |