Class: CASServer::Models::Ticket

Inherits:
Base
  • Object
show all
Defined in:
lib/casserver/models.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cleanup(max_lifetime) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/casserver/models.rb', line 37

def self.cleanup(max_lifetime)
  transaction do
    conditions = ["created_on < ?", Time.now - max_lifetime]
    expired_tickets_count = count(:conditions => conditions)

    $LOG.debug("Destroying #{expired_tickets_count} expired #{self.name.demodulize}"+
      "#{'s' if expired_tickets_count > 1}.") if expired_tickets_count > 0

    destroy_all(conditions)
  end
end

Instance Method Details

#to_sObject



33
34
35
# File 'lib/casserver/models.rb', line 33

def to_s
  ticket
end