has_recent_views.rb 439 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module ApplicationModel::HasRecentViews
  3. extend ActiveSupport::Concern
  4. included do
  5. before_destroy :recent_view_destroy
  6. end
  7. =begin
  8. delete object recent viewed list, will be executed automatically
  9. model = Model.find(123)
  10. model.recent_view_destroy
  11. =end
  12. def recent_view_destroy
  13. RecentView.log_destroy(self.class.to_s, id)
  14. true
  15. end
  16. end