diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-26 18:18:12 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-26 18:18:12 +0100 |
commit | 774bb634d17190a30ed0e22183368ab46f74fe5d (patch) | |
tree | cae42b461406b999251c32fcb790995412ca8df6 /app/models/restore_job.rb | |
parent | 45e7bcdbf5222ea68de2ec8e6542b079c36758cf (diff) |
after_create :queue_the_restore_rake_task
Diffstat (limited to 'app/models/restore_job.rb')
-rw-r--r-- | app/models/restore_job.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/models/restore_job.rb b/app/models/restore_job.rb index 2c2da54..571d967 100644 --- a/app/models/restore_job.rb +++ b/app/models/restore_job.rb @@ -3,11 +3,24 @@ class RestoreJob < ActiveRecord::Base mount_uploader :backup_file, BackupFileUploader + after_create :queue_the_restore_rake_task + def to_s if self.backup_file? File.basename(self.backup_file.to_s) else "RestoreJob ID #{self.id}" end - end + end + + private + def queue_the_restore_rake_task + self.delay.run_the_restore_rake_task + end + + def run_the_restore_rake_task + system "cd #{Rails.root} && rake backup:restore" + end + + end |