Sha256: e3e70cc3b6081aa932c75fbfd47d842e6fee9f45eedac542127c65fcbf1f0bd6
Contents?: true
Size: 686 Bytes
Versions: 5
Compression:
Stored size: 686 Bytes
Contents
module ActiveRegulation module Suspension extend ActiveSupport::Concern included do scope :suspended, -> { where.not(suspended_at: nil) } scope :unsuspended, -> { where(suspended_at: nil) } end def suspend! update(suspended_at: Time.now) if unsuspended? end def unsuspend! update(suspended_at: nil) if suspended? end def suspended? !unsuspended? end def unsuspended? suspended_at.nil? end def suspended_at_or_time suspended? ? Time.now : suspended_at end def to_suspension I18n.t("active_regulation.suspension.#{suspended? ? :suspended : :unsuspended}") end end end
Version data entries
5 entries across 5 versions & 1 rubygems