Class: Spree::Events::DataExportsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/events/data_exports_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#current_event, #default_url_options, #events, #required_user_event!

Methods included from SpreeCmCommissioner::Events::RoleAuthorization

#authorize?, #authorize_admin, #authorize_role!, #redirect_unauthorized_access, #resource_not_found

Instance Method Details

#downloadObject

POST: /data_exports/:id/download

Raises:

  • (ActiveRecord::RecordNotFound)


11
12
13
14
15
16
17
18
# File 'app/controllers/spree/events/data_exports_controller.rb', line 11

def download
  export = SpreeCmCommissioner::Export.find_by(uuid: params[:id])

  raise ActiveRecord::RecordNotFound, 'Export file is not attached. Please try to generate again.' unless export.exported_file.attached?

  redirect_to main_app.rails_blob_url(export.exported_file, expires_in: 3600.seconds)
  # HOST/events/events-tedxphnompenh-2024/data_exports/9313a0c9-5d1f-4c26-983a-f8b796ec141f/download
end

#model_classObject

override



6
7
8
# File 'app/controllers/spree/events/data_exports_controller.rb', line 6

def model_class
  SpreeCmCommissioner::Export
end