Permalink
Browse files

Added method to IM to remove objects by class and id. Then used it to…

… remove objects when updating counters.
  • Loading branch information...
1 parent 4a0a160 commit 024bc70bfe2aa9584ecd67246d85787901362c4e @miloops miloops committed Oct 20, 2010
@@ -73,6 +73,8 @@ def update_counters(id, counters)
"#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{value.abs}"
end
+ IdentityMap.remove_by_id(symbolized_base_class, id) if IdentityMap.enabled?
+
update_all(updates.join(', '), primary_key => id )
end
@@ -59,6 +59,10 @@ def remove(record)
repository[record.class.symbolized_base_class].delete(record.id)
end
+ def remove_by_id(symbolized_base_class, id)
+ repository[symbolized_base_class].delete(id)
+ end
+
def clear
repository.clear
end

0 comments on commit 024bc70

Please sign in to comment.