class Apartment::Adapters::JDBCPostgresqlSchemaAdapter
Separate Adapter for Postgresql when using schemas
Public Instance Methods
connect_to_new(tenant = nil)
click to toggle source
Set schema search path to new schema
# File lib/apartment/adapters/jdbc_postgresql_adapter.rb, line 38 def connect_to_new(tenant = nil) return reset if tenant.nil? raise ActiveRecord::StatementInvalid.new("Could not find schema #{tenant}") unless Apartment.connection.all_schemas.include? tenant.to_s @current = tenant.to_s Apartment.connection.schema_search_path = full_search_path rescue ActiveRecord::StatementInvalid, ActiveRecord::JDBCError raise TenantNotFound, "One of the following schema(s) is invalid: #{full_search_path}" end
Private Instance Methods
rescue_from()
click to toggle source
# File lib/apartment/adapters/jdbc_postgresql_adapter.rb, line 51 def rescue_from ActiveRecord::JDBCError end