Class: Juici::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/juici/database.rb

Class Method Summary collapse

Class Method Details

.initialize!Object



11
12
13
14
15
16
17
# File 'lib/juici/database.rb', line 11

def initialize!
  if ENV['RACK_ENV'] == "development"
    Mongoid.logger.level = Logger::INFO
  end

  Mongoid.load!(mongoid_config_file)
end

.mongoid_config_fileObject



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

def mongoid_config_file
  %w[mongoid.yml mongoid.yml.sample].each do |file|
    path = File.join("config", file)
    return path if File.exist?(path)
  end
  raise "No database config file"
end