Module: Multiverse::DatabaseTasks

Defined in:
lib/multiverse/patches.rb

Instance Method Summary collapse

Instance Method Details

#each_current_configuration(environment) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/multiverse/patches.rb', line 3

def each_current_configuration(environment)
  environments = [Multiverse.env(environment)]
  environments << Multiverse.env("test") if environment == "development"

  self.migrations_paths = Multiverse.migrate_path
  self.db_dir = Multiverse.db_dir

  configurations = ActiveRecord::Base.configurations.values_at(*environments)
  configurations.compact.each do |configuration|
    yield configuration unless configuration['database'].blank?
  end
end