Class: CASServer::Model::Ticket

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cleanup(max_lifetime) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/casserver/model.rb', line 42

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



38
39
40
# File 'lib/casserver/model.rb', line 38

def to_s
  ticket
end