Sha256: 685b7aa5e20776f19b320fc0d2c7374173783a39bd05c9560e9f11426bc1c22a
Contents?: true
Size: 491 Bytes
Versions: 73
Compression:
Stored size: 491 Bytes
Contents
module Suspendable extend ActiveSupport::Concern included do field :suspended_at, :as => :datetime scope :suspended, where("suspended_at IS NULL") end def active? super && !suspended? end def inactive_message !suspended? ? super : :suspended end def suspend! update_attributes(:suspended_at => Time.now.utc) end def unsuspend! update_attributes(:suspended_at => nil) end def suspended? !suspended_at.nil? end end
Version data entries
73 entries across 73 versions & 1 rubygems