lib/active_regulation/quarantine.rb in active_regulation-4.0.3 vs lib/active_regulation/quarantine.rb in active_regulation-5.0.0
- old
+ new
@@ -1,16 +1,18 @@
+# frozen_string_literal: true
+
module ActiveRegulation
module Quarantine
extend ActiveSupport::Concern
included do
scope :quarantined, -> { where.not(quarantined_at: nil) }
scope :unquarantined, -> { where(quarantined_at: nil) }
end
def quarantine!
- update(quarantined_at: Time.now) if unquarantined?
+ update(quarantined_at: Time.current) if unquarantined?
end
def unquarantine!
update(quarantined_at: nil) if quarantined?
end
@@ -22,10 +24,10 @@
def unquarantined?
quarantined_at.nil?
end
def quarantined_at_or_time
- unquarantined? ? Time.now : quarantined_at
+ unquarantined? ? Time.current : quarantined_at
end
def to_quarantine
I18n.t("active_regulation.quarantine.#{unquarantined? ? :unquarantined : :quarantined}")
end