Created
November 29, 2011 20:43
-
-
Save cbeer/1406418 to your computer and use it in GitHub Desktop.
Exclude models from the Rails identity map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record/identity_map' | |
module ActiveRecord | |
module IdentityMap | |
class << self | |
alias_method :add_without_exclude, :add | |
def exclusions | |
@exclusions ||= [] | |
end | |
def add(record) | |
return if self.exclusions.include? record.class | |
add_without_exclude(record) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment