Sha256: b9040b4e8ddd048978478dae7ef5e45d36b31d851a9904c8334c7e335b442fba
Contents?: true
Size: 860 Bytes
Versions: 4
Compression:
Stored size: 860 Bytes
Contents
# frozen_string_literal: true module Lite module Regulations module Suspension extend ActiveSupport::Concern included do scope :suspended, -> { where.not(suspended_at: nil) } scope :unsuspended, -> { where(suspended_at: nil) } end def suspend! return true if suspended? update(suspended_at: Time.current) end def suspended? !unsuspended? end def suspended_at_or_time return suspended_at if unsuspended? Lite::Regulations::Base.timestamp end def to_suspension I18n.t("lite.regulations.suspension.#{:un if unsuspended?}suspended") end def unsuspend! return true if unsuspended? update(suspended_at: nil) end def unsuspended? suspended_at.nil? end end end end
Version data entries
4 entries across 4 versions & 1 rubygems