lib/apartment/database.rb in apartment-0.10.3 vs lib/apartment/database.rb in apartment-0.11.0
- old
+ new
@@ -4,16 +4,16 @@
module Database
class << self
# pass these methods to our adapter
- delegate :create, :switch, :reset, :process, :seed, :current_database, :to => :adapter
+ delegate :create, :current_database, :process, :process_excluded_models, :reset, :seed, :switch, :to => :adapter
# Call init to establish a connection to the public schema on all excluded models
# This must be done before creating any new schemas or switching
def init
- connect_exclusions
+ process_excluded_models
end
def adapter
@adapter ||= begin
adapter_method = "#{config[:adapter]}_adapter"
@@ -37,17 +37,9 @@
@config = nil
end
private
- def connect_exclusions
- # Establish a connection for each specific excluded model
- # Thus all other models will shared a connection (at ActiveRecord::Base) and we can modify at will
- Apartment.excluded_models.each do |excluded_model|
- excluded_model.establish_connection config
- end
- end
-
def config
@config ||= Rails.configuration.database_configuration[Rails.env].symbolize_keys
end
end
\ No newline at end of file