lib/datamapper4rails/database_config.rb in datamapper4rail-0.1.0 vs lib/datamapper4rails/database_config.rb in datamapper4rail-0.2.0
- old
+ new
@@ -4,11 +4,16 @@
RAILS_ROOT + "/config/database.yml"
end
def create_connection()
conf = config.dup
- repositories = conf.delete(:repositories)
- ::DataMapper.setup(:default, conf) unless conf.empty?
+ if repositories = conf.delete(:repositories)
+ repositories.each do |repo, conf|
+ ::DataMapper.setup(repo, conf) unless conf.empty?
+ end
+ else
+ ::DataMapper.setup(:default, conf) unless conf.empty?
+ end
end
def get_config_for_environment
if hash = full_config[RAILS_ENV]
symbolize_keys(hash)