app/models/extface/job.rb in extface-0.0.6 vs app/models/extface/job.rb in extface-0.0.7
- old
+ new
@@ -1,9 +1,11 @@
module Extface
class Job < ActiveRecord::Base
belongs_to :device, inverse_of: :jobs
scope :active, ->{ where(arel_table[:completed_at].eq(nil).and(arel_table[:failed_at].eq(nil))) }
+ scope :completed, ->{ where(arel_table[:completed_at].not_eq(nil)) }
+ scope :failed, ->{ where(arel_table[:failed_at].not_eq(nil)) }
def complete!
self.completed_at = Time.now
save!
notify("Job #{self.id} completed!")