Class: Bookfile::Database
- Inherits:
-
Object
- Object
- Bookfile::Database
- Defined in:
- lib/bookfile/database/database.rb
Direct Known Subclasses
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(db_config) ⇒ Database
constructor
A new instance of Database.
-
#setup ⇒ Object
use connect/prepare - why, why not??.
Constructor Details
#initialize(db_config) ⇒ Database
Returns a new instance of Database.
7 8 9 |
# File 'lib/bookfile/database/database.rb', line 7 def initialize( db_config ) @db_config = db_config end |
Instance Method Details
#connect ⇒ Object
11 12 13 14 15 |
# File 'lib/bookfile/database/database.rb', line 11 def connect print " connecting..." ActiveRecord::Base.establish_connection( @db_config ) puts "OK" end |
#setup ⇒ Object
use connect/prepare - why, why not??
17 18 19 20 |
# File 'lib/bookfile/database/database.rb', line 17 def setup ## use connect/prepare - why, why not?? prepare # step 1: prepare - require and include models connect # step 2: connect end |