Skip to content
Vinicius Stock edited this page Feb 19, 2019 · 1 revision

Cron

Setting

Sail.set(:my_cron_setting, "0 * * * *")

Getting

Sail.get(:my_cron_setting)
=> true

Sail.get(:my_date_setting) do |setting_value|
  puts setting_value
end
=> true

Examples

Cron settings return true if the current time matches the passed cron expression. This can be used for specific checks in recurring events.

class Entry < ApplicationRecord
  .
  .
  .

  def created_at_top_of_the_hour?
    Sail.get(:top_of_the_hour_cron)
  end
end
Clone this wiki locally