app/models/extface/job.rb in extface-0.4.2 vs app/models/extface/job.rb in extface-0.4.3a

- old
+ new

@@ -1,7 +1,9 @@ module Extface class Job < ActiveRecord::Base + attr_accessor :thread + 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)) } @@ -16,9 +18,10 @@ !!completed_at end def connected! unless connected? + p "device connected at #{Time.now}" self.connected_at = Time.now save! notify("Job #{self.id} device connected!") end end