Sha256: 2c8f54a2620af458b8c1f17cd5b5dad3de469808d0505a72b48ad4652d24a240

Contents?: true

Size: 607 Bytes

Versions: 3

Compression:

Stored size: 607 Bytes

Contents

class Database

  attr_accessor :rails_root, :generator

  def initialize(rails_root, single, force)
    @single = single
    @rails_root = rails_root
    @generator = Generator.new(@rails_root, single, force)
  end

  def load
    file = File.join(@rails_root, 'config', 'database.yml')
    yaml = YAML.load_file(file)
    connect(yaml)
  end

  def connect(yaml)
    host = yaml['development']['host']
    host ||= 'localhost'
    ActiveRecord::Base.establish_connection(:adapter => "mysql2", 
                      :database => yaml['development']['database'])
    @generator.create_factories
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
industrial_girl-0.0.3 lib/database.rb
industrial_girl-0.0.2 lib/database.rb
industrial_girl-0.0.1 lib/database.rb