lib/apartment/database.rb in apartment-0.13.1 vs lib/apartment/database.rb in apartment-0.14.0
- old
+ new
@@ -1,31 +1,31 @@
require 'active_support/core_ext/module/delegation'
module Apartment
# The main entry point to Apartment functions
- module Database
-
- extend self
+ module Database
+
+ extend self
- delegate :create, :current_database, :process, :process_excluded_models, :reset, :seed, :switch, :to => :adapter
+ delegate :create, :current_database, :drop, :process, :process_excluded_models, :reset, :seed, :switch, :to => :adapter
# Initialize Apartment config options such as excluded_models
#
- def init
+ def init
process_excluded_models
end
# Fetch the proper multi-tenant adapter based on Rails config
#
# @return {subclass of Apartment::AbstractAdapter}
#
def adapter
- @adapter ||= begin
- adapter_method = "#{config[:adapter]}_adapter"
-
- begin
+ @adapter ||= begin
+ adapter_method = "#{config[:adapter]}_adapter"
+
+ begin
require "apartment/adapters/#{adapter_method}"
rescue LoadError => e
raise "The adapter `#{config[:adapter]}` is not yet supported"
end
@@ -42,16 +42,16 @@
def reload!
@adapter = nil
@config = nil
end
- private
-
+ private
+
# Fetch the rails database configuration
#
def config
@config ||= Rails.configuration.database_configuration[Rails.env].symbolize_keys
end
end
-
+
end
\ No newline at end of file