Module: SeedingUtils

Extended by:
SeedingUtils
Included in:
SeedingUtils
Defined in:
lib/seeding_utils.rb,
lib/seeding_utils/version.rb

Defined Under Namespace

Classes: Table

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#connect(callable) ⇒ Object

Expects a proc that when called, returns a raw PG connection. For example:

SeedingUtils.connection = -> {ActiveRecord::Base.connection.raw_connection}

or:

SeedingUtils.connection = -> {PG::Connection.open dbname: 'foo'}


14
15
16
# File 'lib/seeding_utils.rb', line 14

def connect(callable)
  @connection_callable = callable
end

#connectionObject



19
20
21
# File 'lib/seeding_utils.rb', line 19

def connection
  @connection_callable.call
end