Add Job#load to load info from DB

This commit is contained in:
Dzmitry Plashchynski
2015-03-06 23:44:30 +02:00
parent c54f52a71d
commit 78b1d8d6e1
2 changed files with 17 additions and 0 deletions

View File

@@ -35,6 +35,10 @@ module Crono
model.update(last_performed_at: last_performed_at)
end
def load
self.last_performed_at = model.last_performed_at
end
private
def model
@model ||= Crono::CronoJob.find_or_create_by(job_id: job_id)