session.rb 566 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
  2. require 'history'
  3. class Observer::Session < ActiveRecord::Observer
  4. observe 'active_record::_session_store::_session'
  5. def before_create(record)
  6. check(record)
  7. end
  8. def before_update(record)
  9. check(record)
  10. end
  11. def check(record)
  12. return if !record.data
  13. return if record[:request_type]
  14. # remember request type
  15. if record.data['request_type']
  16. record[:request_type] = record.data['request_type']
  17. record.data.delete('request_type')
  18. end
  19. end
  20. end