Class: Khronos::Storage::Adapter::ActiveRecord::Schedule

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/khronos/storage/adapter/activerecord/schedule.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fetch(time) ⇒ Object



13
14
15
16
17
# File 'lib/khronos/storage/adapter/activerecord/schedule.rb', line 13

def fetch(time)
  self.find_by_sql([
    "UPDATE #{self.table_name} SET active = false WHERE at <= ? AND active = true RETURNING *", time
  ])
end

Instance Method Details

#callbacksObject



24
25
26
# File 'lib/khronos/storage/adapter/activerecord/schedule.rb', line 24

def callbacks
  JSON.parse(read_attribute(:callbacks) || '{}')
end

#callbacks=(options) ⇒ Object



20
21
22
# File 'lib/khronos/storage/adapter/activerecord/schedule.rb', line 20

def callbacks=(options)
  write_attribute(:callbacks, options.to_json)
end