Class: Ghost::Seeder::DbConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/ghost/seeder/db_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ DbConnection

Returns a new instance of DbConnection.


6
7
8
9
# File 'lib/ghost/seeder/db_connection.rb', line 6

def initialize(environment)
  @environment = environment
  configure!
end

Instance Method Details

#connect!Object


11
12
13
14
15
# File 'lib/ghost/seeder/db_connection.rb', line 11

def connect!
  ActiveRecord::Base.establish_connection(
    @connection_options
  )
end

#disconnect!Object


17
18
19
# File 'lib/ghost/seeder/db_connection.rb', line 17

def disconnect!
  ActiveRecord::Base.connection.disconnect!
end