lib/apartment.rb in apartment-0.17.3 vs lib/apartment.rb in apartment-0.18.0

- old
+ new

@@ -1,16 +1,18 @@ require 'apartment/railtie' if defined?(Rails) module Apartment class << self - ACCESSOR_METHODS = [:use_postgres_schemas, :seed_after_create, :prepend_environment] - WRITER_METHODS = [:database_names, :excluded_models, :default_schema, :persistent_schemas] + ACCESSOR_METHODS = [:use_postgres_schemas, :seed_after_create, :prepend_environment, :append_environment] + WRITER_METHODS = [:database_names, :excluded_models, :default_schema, :persistent_schemas, :connection_class] attr_accessor(*ACCESSOR_METHODS) attr_writer(*WRITER_METHODS) + delegate :connection, :establish_connection, to: :connection_class + # configure apartment with available options def configure yield self if block_given? end @@ -33,9 +35,13 @@ @default_schema || "public" end def persistent_schemas @persistent_schemas || [] + end + + def connection_class + @connection_class || ActiveRecord::Base end # Reset all the config for Apartment def reset (ACCESSOR_METHODS + WRITER_METHODS).each{|method| instance_variable_set(:"@#{method}", nil) }