has_recent_views.rb 437 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://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