Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save we4tech/560f02dd1a1a456b42c8280a997627c2 to your computer and use it in GitHub Desktop.
Save we4tech/560f02dd1a1a456b42c8280a997627c2 to your computer and use it in GitHub Desktop.
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