2017-01-31 17:13:45 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2017-05-02 15:21:13 +00:00
|
|
|
module ApplicationModel::HasRecentViews
|
2017-01-31 17:13:45 +00:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
before_destroy :recent_view_destroy
|
|
|
|
end
|
|
|
|
|
|
|
|
=begin
|
|
|
|
|
|
|
|
delete object recent viewed list, will be executed automatically
|
|
|
|
|
|
|
|
model = Model.find(123)
|
|
|
|
model.recent_view_destroy
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
|
|
|
def recent_view_destroy
|
|
|
|
RecentView.log_destroy(self.class.to_s, id)
|
2017-06-16 22:53:20 +00:00
|
|
|
true
|
2017-01-31 17:13:45 +00:00
|
|
|
end
|
|
|
|
end
|