Module: Suspendable

Extended by:
ActiveSupport::Concern
Defined in:
app/models/suspendable.rb

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/suspendable.rb', line 9

def active?
  super && !suspended? 
end

#inactive_messageObject



13
14
15
# File 'app/models/suspendable.rb', line 13

def inactive_message 
  !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

Returns:

  • (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