Created
July 30, 2018 18:00
-
-
Save we4tech/560f02dd1a1a456b42c8280a997627c2 to your computer and use it in GitHub Desktop.
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
module ActiveRecord | |
module ConnectionAdapters | |
module PostgreSQL | |
module SchemaStatements | |
alias_method :old_schema_search_path=, :schema_search_path= | |
alias_method :old_schema_search_path, :schema_search_path | |
def schema_search_path=(schema_csv) | |
unless schema_search_path == schema_csv | |
self.old_schema_search_path = schema_csv | |
(Thread.current[:schema_search_path_caches] ||= {})[object_id] = schema_csv | |
end | |
end | |
def schema_search_path | |
caches = Thread.current[:schema_search_path_caches] ||= {} | |
caches[object_id] ||= old_schema_search_path | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment