Module: Sinatra::Database

Defined in:
lib/herbert/Services.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/herbert/Services.rb', line 3

def self.registered(app)
  app.set :mongo_connection, Mongo::Connection.new(app.settings.db_settings[:host],
  app.settings.db_settings[:porty],
  app.settings.db_settings[:options])
  log.h_debug("Connected to MongoDB #{app.settings.mongo_connection}")
  app.set :mongo_db, app.settings.mongo_connection.db(app.settings.db_settings[:db_name])
end

Instance Method Details

#dbObject



11
12
13
# File 'lib/herbert/Services.rb', line 11

def db
  settings.mongo_db
end