blob: 438f1e58ba6c2d0e0b8470418281b306b1984e06 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 | if ENV['RAILS_DB_ADAPTER'] == 'nulldb'
  require 'apartment/adapters/abstract_adapter'
  module Apartment
    module Tenant
      def adapter
        Thread.current[:apartment_adapter] ||= nulldb_adapter(config)
      end
      def self.nulldb_adapter(config)
        adapter = Adapters::NulldbAdapter
        adapter.new(config)
      end
    end
    module Adapters
      # Default adapter when not using Postgresql Schemas
      class NulldbAdapter < AbstractAdapter
        def initialize config
          super
        end
      end
    end
  end
end
 |