Class: OpsBackups::BackupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- OpsBackups::BackupsController
- Defined in:
- app/controllers/ops_backups/backups_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/ops_backups/backups_controller.rb', line 13 def destroy backup = OpsBackups::Backup.find(params[:id]) backup.destroy redirect_to backups_url, notice: "#{backup} destroyed." end |
#download ⇒ Object
8 9 10 11 |
# File 'app/controllers/ops_backups/backups_controller.rb', line 8 def download backup = OpsBackups::Backup.find(params[:id]) redirect_to backup.backup_file.url(disposition: :attachment), allow_other_host: true end |
#index ⇒ Object
3 4 5 6 |
# File 'app/controllers/ops_backups/backups_controller.rb', line 3 def index @backups = OpsBackups::Backup.all.order(updated_at: :desc) @jobs = jobs end |
#trigger_job ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/ops_backups/backups_controller.rb', line 19 def trigger_job job_name = params[:job_name] job_config = jobs[job_name] job_class = job_config["class"].constantize args = job_config["args"] || [] Rails.logger.info "Triggering job: #{job_name} with args: #{args.reduce({}, :merge).symbolize_keys}" job_class.perform_later(args.reduce({}, :merge).symbolize_keys) redirect_to backups_url, notice: "#{job_name} triggered successfully." end |