Module: Rails::DataMapper

Extended by:
ActiveSupport::Memoizable
Defined in:
lib/datamapper4rails/rails_datamapper.rb

Class Method Summary collapse

Class Method Details

.create_connectionObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/datamapper4rails/rails_datamapper.rb', line 9

def create_connection
  # TODO: handle Rails and Merb style database.yml files
  conf = config.dup
  repositories = conf.delete(:repositories)
  if(repositories)
    repositories.each do |key, config|
      ::DataMapper.setup(key.to_sym, config)
    end
  else
    ::DataMapper.setup(:default, conf) unless conf.empty?
  end
end