Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Logging mongoid in Sinatra
# encoding: utf-8
require 'mongoid'
# Connection.new takes host, port
host = 'localhost'
port = Mongo::Connection::DEFAULT_PORT
database_name = case ENV['RACK_ENV'].to_sym
when :development then 'varena'
when :production then 'varena'
when :test then 'varena_test'
end
Mongoid.configure do |config|
config.master = Mongo::Connection.new(host, port, logger: Logger.new($stdout)).db(database_name)
config.raise_not_found_error = false
end
desc "Irb with DB environment loaded"
task :console do
require './config/database'
require "irb"
ARGV.clear
IRB.start
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.