lib/apartment.rb in apartment-1.2.0 vs lib/apartment.rb in apartment-2.0.0

- old
+ new

@@ -1,11 +1,10 @@ require 'apartment/railtie' if defined?(Rails) require 'active_support/core_ext/object/blank' require 'forwardable' require 'active_record' require 'apartment/tenant' -require 'apartment/deprecation' module Apartment class << self @@ -73,39 +72,15 @@ return @seed_data_file if defined?(@seed_data_file) @seed_data_file = "#{Rails.root}/db/seeds.rb" end - def tld_length - @tld_length || 1 - end - # Reset all the config for Apartment def reset (ACCESSOR_METHODS + WRITER_METHODS).each{|method| remove_instance_variable(:"@#{method}") if instance_variable_defined?(:"@#{method}") } end - def database_names - Apartment::Deprecation.warn "[Deprecation Warning] `database_names` is now deprecated, please use `tenant_names`" - tenant_names - end - - def database_names=(names) - Apartment::Deprecation.warn "[Deprecation Warning] `database_names=` is now deprecated, please use `tenant_names=`" - self.tenant_names=(names) - end - - def use_postgres_schemas - Apartment::Deprecation.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) - Apartment::Deprecation.warn "[Deprecation Warning] `use_postgresql_schemas=` is now deprecated, please use `use_schemas=`" - self.use_schemas = to_use_or_not_to_use - end - def extract_tenant_config return {} unless @tenant_names values = @tenant_names.respond_to?(:call) ? @tenant_names.call : @tenant_names unless values.is_a? Hash values = values.each_with_object({}) do |tenant, hash| @@ -121,9 +96,12 @@ # Exceptions ApartmentError = Class.new(StandardError) # Raised when apartment cannot find the adapter specified in <tt>config/database.yml</tt> AdapterNotFound = Class.new(ApartmentError) + + # Raised when apartment cannot find the file to be loaded + FileNotFound = Class.new(ApartmentError) # Tenant specified is unknown TenantNotFound = Class.new(ApartmentError) # The Tenant attempting to be created already exists