Class: Goz::Database
- Inherits:
-
Object
- Object
- Goz::Database
- Defined in:
- lib/goz/database.rb,
lib/goz/database/migrations.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Migrations
Constant Summary collapse
- DB =
Sequel database instance
ENV['GOZ_DATABASE_URL'] ? Sequel.connect( ENV['GOZ_DATABASE_URL'] ) : Sequel.sqlite
Class Method Summary collapse
- .connect!(url) ⇒ Object
-
.instance {|DB| ... } ⇒ Object
Get database instance.
Class Method Details
.connect!(url) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/goz/database.rb', line 45 def self.connect!(url) self.send( :remove_const, :'DB' ) if self.const_defined?( :'DB' ) self.const_set :'DB', Sequel.connect(url) Goz::Database::Migrations.migrate! self.instance end |