Sha256: 25fc80729860bff63c49061274c11655164b0013f8f68e5e1eec830533e8dbd0
Contents?: true
Size: 558 Bytes
Versions: 6
Compression:
Stored size: 558 Bytes
Contents
module ActiveRegulation module Visibility extend ActiveSupport::Concern included do scope :visible, -> { where(invisible_at: nil) } scope :invisible, -> { where.not(invisible_at: nil) } end def invisible! update(invisible_at: Time.now) end def visible! update(invisible_at: nil) end def invisible? !visible? end def visible? invisible_at.nil? end def to_visibility I18n.t("active_regulation.visibility.#{visible? ? :visible : :invisible}") end end end
Version data entries
6 entries across 6 versions & 1 rubygems