lib/active_regulation/containment.rb in active_regulation-4.0.3 vs lib/active_regulation/containment.rb in active_regulation-5.0.0

- old
+ new

@@ -1,16 +1,18 @@ +# frozen_string_literal: true + module ActiveRegulation module Containment extend ActiveSupport::Concern included do scope :contained, -> { where.not(contained_at: nil) } scope :uncontained, -> { where(contained_at: nil) } end def contain! - update(contained_at: Time.now) if uncontained? + update(contained_at: Time.current) if uncontained? end def uncontain! update(contained_at: nil) if contained? end @@ -22,10 +24,10 @@ def uncontained? contained_at.nil? end def contained_at_or_time - uncontained? ? Time.now : contained_at + uncontained? ? Time.current : contained_at end def to_containment I18n.t("active_regulation.containment.#{uncontained? ? :uncontained : :contained}") end