http_log.rb 415 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class HttpLog < ApplicationModel
  3. store :request
  4. store :response
  5. =begin
  6. cleanup old http logs
  7. HttpLog.cleanup
  8. optional you can put the max oldest chat entries as argument
  9. HttpLog.cleanup(1.month)
  10. =end
  11. def self.cleanup(diff = 1.month)
  12. HttpLog.where('created_at < ?', Time.zone.now - diff).delete_all
  13. true
  14. end
  15. end