Commit 0684d064190afc19edad666f0efe970b0842f23a
1 parent
6466fec2
Exists in
master
and in
1 other branch
Switched mongoid to connect via Heroku MONGOHQ_URL
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,9 @@ |
1 | +if ENV['MONGOHQ_URL'] | |
2 | + settings = URI.parse(ENV['MONGOHQ_URL'] || 'mongodb://localhost/sushi') | |
3 | + database_name = settings.path.gsub(/^\//, '') | |
4 | + | |
5 | + Mongoid.configure do |config| | |
6 | + config.master = Mongo::Connection.new(settings.host, settings.port).db(database_name) | |
7 | + config.master.authenticate(settings.user, settings.password) if settings.user | |
8 | + end | |
9 | +end | |
0 | 10 | \ No newline at end of file | ... | ... |