diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 6fd36e31e..359d268d8 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -21,7 +21,7 @@ class ApplicationModel < ActiveRecord::Base after_create :activity_stream_create after_update :activity_stream_update - after_destroy :activity_stream_destroy + before_destroy :activity_stream_destroy after_create :history_create after_update :history_update @@ -31,7 +31,7 @@ class ApplicationModel < ActiveRecord::Base after_update :search_index_update after_destroy :search_index_destroy - after_destroy :recent_view_destroy + before_destroy :recent_view_destroy # create instance accessor class << self diff --git a/app/models/recent_view.rb b/app/models/recent_view.rb index 5bd6193b8..945308202 100644 --- a/app/models/recent_view.rb +++ b/app/models/recent_view.rb @@ -22,9 +22,10 @@ class RecentView < ApplicationModel end def self.log_destroy( requested_object, requested_object_id ) + return if requested_object == 'RecentView' RecentView.where( :recent_view_object_id => ObjectLookup.by_name( requested_object ) ). - where( :o_id => requested_object_id ). - destroy_all + where( :o_id => requested_object_id ). + destroy_all end def self.user_log_destroy( user )