Module: Suspendable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/suspendable.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #inactive_message ⇒ Object
- #suspend! ⇒ Object
- #suspended? ⇒ Boolean
- #unsuspend! ⇒ Object
Instance Method Details
#active? ⇒ Boolean
9 10 11 |
# File 'app/models/suspendable.rb', line 9 def active? super && !suspended? end |
#inactive_message ⇒ Object
13 14 15 |
# File 'app/models/suspendable.rb', line 13 def !suspended? ? super : :suspended end |
#suspend! ⇒ Object
17 18 19 |
# File 'app/models/suspendable.rb', line 17 def suspend! update_attributes(:suspended_at => Time.now.utc) end |
#suspended? ⇒ Boolean
25 26 27 |
# File 'app/models/suspendable.rb', line 25 def suspended? !suspended_at.nil? end |
#unsuspend! ⇒ Object
21 22 23 |
# File 'app/models/suspendable.rb', line 21 def unsuspend! update_attributes(:suspended_at => nil) end |