Class: Rbfam::DbConfig

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rbfam/db_config.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap!Object



13
14
15
16
17
# File 'lib/rbfam/db_config.rb', line 13

def bootstrap!
  ensure_action("Are you sure you'd like to completely rebuild the database? This takes around 10 minutes.") do
    Rake::Task["db:reset"].invoke
  end
end

#clear!Object



25
26
27
28
29
# File 'lib/rbfam/db_config.rb', line 25

def clear!
  ensure_action("Are you sure you'd like drop the database? This can't be un-done.") do
    Rake::Task["db:drop"].invoke
  end
end

#connectObject



31
32
33
# File 'lib/rbfam/db_config.rb', line 31

def connect
  ActiveRecord::Base.establish_connection(scoped_config)
end

#scoped_configObject



9
10
11
# File 'lib/rbfam/db_config.rb', line 9

def scoped_config
  config[env]
end

#seed!Object



19
20
21
22
23
# File 'lib/rbfam/db_config.rb', line 19

def seed!
  ensure_action("Are you sure you'd like to re-seed the database? This is faster than bootstrap!, and won't delete data.") do
    Rake::Task["db:seed"].invoke
  end
end