-
Notifications
You must be signed in to change notification settings - Fork 32
Date
Vinicius Stock edited this page Feb 19, 2019
·
2 revisions
Sail.set(:my_date_setting, "2019-01-01 10:00")
Sail.set(:my_date_setting, DateTime.now)
Sail.get(:my_date_setting)
=> Tue, 01 Jan 2019 10:00:00 +0000
Sail.get(:my_date_setting) do |setting_value|
puts setting_value
end
=> Tue, 01 Jan 2019 10:00:00 +0000
Date settings return a DateTime object. These can be used to define a configurable expiration date for example.
class Promotion < ApplicationRecord
.
.
.
def expired?
DateTime.now > Sail.get(:promotion_expiration_date)
end
end