Module: Pageflow::Suspendable

Included in:
UserMixin
Defined in:
app/models/concerns/pageflow/suspendable.rb

Instance Method Summary collapse

Instance Method Details

#active_for_authentication?Boolean

Returns:

  • (Boolean)

3
4
5
# File 'app/models/concerns/pageflow/suspendable.rb', line 3

def active_for_authentication?
  super && !suspended?
end

#suspend!Object


11
12
13
14
15
# File 'app/models/concerns/pageflow/suspendable.rb', line 11

def suspend!
  return if suspended?
  self.suspended_at = Time.zone.now
  save(:validate => false)
end

#suspended?Boolean

Returns:

  • (Boolean)

7
8
9
# File 'app/models/concerns/pageflow/suspendable.rb', line 7

def suspended?
  suspended_at?
end

#unsuspend!Object


17
18
19
20
21
# File 'app/models/concerns/pageflow/suspendable.rb', line 17

def unsuspend!
  return unless suspended?
  self.suspended_at = nil
  save(:validate => false)
end