Improved order of callback for destroy (delete references first).
This commit is contained in:
parent
62b07e2f35
commit
5f401a7b04
2 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -22,6 +22,7 @@ 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
|
||||
|
|
Loading…
Reference in a new issue