Skip to content

Commit

Permalink
Disable retrieval of DESTROY records via LIKE query
Browse files Browse the repository at this point in the history
The LIKE query no longer matches the format of DESTROY records.
The LIKE query is very expensive.
The 'associated' association is a much better way to identify
DESTROY records.
  • Loading branch information
joshuaflanagan committed Sep 21, 2012
1 parent 5910202 commit ac04e74
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/acts_as_audited/auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,15 @@ def deep_display_audits(display_map)
audit_list.each {|item| item.display_map = display_map}
if display_map[:associations]
# see what associations have deletes audited against them
deleted_audit_types = Audit.deleted_audit_types(self)


# Audit.deleted_audit_types performs very expensive LIKE queries.
# The LIKE queries are no longer formed correctly to match against
# the new format of the audited_changes hash.
# I am commenting it out for now. The new solution is going to take
# advantage of the 'associated' accessor to find deleted objects.
deleted_audit_types = [] #Audit.deleted_audit_types(self)

self.class.reflections.each do |key, value|
next if [:versions, :audits].include? key
next unless display_map[:associations].keys.include? key
Expand Down

0 comments on commit ac04e74

Please sign in to comment.