Sha256: a9c6626b5fe3042f2437f40fa55f8f6729a002c85070e3530cb1a7a87c75cbca
Contents?: true
Size: 611 Bytes
Versions: 6
Compression:
Stored size: 611 Bytes
Contents
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? end def uncontain! update(contained_at: nil) if contained? end def contained? !uncontained? end def uncontained? contained_at.nil? end def to_containment I18n.t("active_regulation.containment.#{uncontained? ? :uncontained : :contained}") end end end
Version data entries
6 entries across 6 versions & 1 rubygems