lib/penthouse/tenants/schema_tenant.rb in penthouse-0.12.0 vs lib/penthouse/tenants/schema_tenant.rb in penthouse-0.12.1
- old
+ new
@@ -38,13 +38,15 @@
# @return [void]
def call(&block)
begin
# set the search path to include the tenant
ActiveRecord::Base.connection.schema_search_path = persistent_schemas.dup.unshift(tenant_schema).join(", ")
+ ActiveRecord::Base.connection.clear_query_cache
block.yield(self)
ensure
# reset the search path back to the default
ActiveRecord::Base.connection.schema_search_path = persistent_schemas.dup.unshift(previous_schema).join(", ")
+ ActiveRecord::Base.connection.clear_query_cache
end
end
# creates the tenant schema
# @param run_migrations [Boolean] whether or not to run migrations, defaults to Penthouse.configuration.migrate_tenants?