Class: Apartment::Adapters::PostgresqlSchemaAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/apartment/adapters/postgresql_adapter.rb

Overview

Separate Adapter for Postgresql when using schemas

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#default_tenant

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#create, #drop, #each, #environmentify, #process_excluded_models, #seed_data, #switch, #switch!

Constructor Details

#initialize(config) ⇒ PostgresqlSchemaAdapter

Returns a new instance of PostgresqlSchemaAdapter.



28
29
30
31
32
# File 'lib/apartment/adapters/postgresql_adapter.rb', line 28

def initialize(config)
  super

  reset
end

Instance Method Details

#currentObject



43
44
45
# File 'lib/apartment/adapters/postgresql_adapter.rb', line 43

def current
  @current || default_tenant
end

#resetObject

Reset schema search path to the default schema_search_path

@return {String} default schema search path


38
39
40
41
# File 'lib/apartment/adapters/postgresql_adapter.rb', line 38

def reset
  @current = default_tenant
  Apartment.connection.schema_search_path = full_search_path
end