summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-26 18:18:12 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-26 18:18:12 +0100
commit774bb634d17190a30ed0e22183368ab46f74fe5d (patch)
treecae42b461406b999251c32fcb790995412ca8df6 /app/models
parent45e7bcdbf5222ea68de2ec8e6542b079c36758cf (diff)
after_create :queue_the_restore_rake_task
Diffstat (limited to 'app/models')
-rw-r--r--app/models/restore_job.rb15
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