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

- old
+ new

@@ -1,11 +1,13 @@ require 'apartment/railtie' if defined?(Rails) +require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/object/blank' module Apartment class << self - ACCESSOR_METHODS = [:use_postgres_schemas, :seed_after_create, :prepend_environment, :append_environment] + ACCESSOR_METHODS = [:use_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) @@ -14,15 +16,10 @@ # configure apartment with available options def configure yield self if block_given? end - # Default switch schema to public - def schema_to_switch - @schema_to_switch || "public" - end - # Be careful not to use `return` here so both Proc and lambda can be used without breaking def database_names @database_names.respond_to?(:call) ? @database_names.call : @database_names end @@ -44,9 +41,19 @@ end # Reset all the config for Apartment def reset (ACCESSOR_METHODS + WRITER_METHODS).each{|method| instance_variable_set(:"@#{method}", nil) } + end + + def use_postgres_schemas + warn "[Deprecation Warning] `use_postgresql_schemas` is now deprecated, please use `use_schemas`" + use_schemas + end + + def use_postgres_schemas=(to_use_or_not_to_use) + warn "[Deprecation Warning] `use_postgresql_schemas=` is now deprecated, please use `use_schemas=`" + self.use_schemas = to_use_or_not_to_use end end autoload :Database, 'apartment/database'