Permalink
Browse files

Mongo extension to access the db with Mongo.db.

  • Loading branch information...
1 parent 198933b commit 737a5312d687e97fb72820de90f895d3d8882f28 @jcxplorer committed Mar 3, 2011
Showing with 16 additions and 0 deletions.
  1. +6 −0 config/snowfinch.yml
  2. +10 −0 lib/mongo_ext.rb
@@ -1,8 +1,14 @@
development:
host: "snowfinch.rails.fi:3000"
mailer_sender: "support@snowfinch.net"
+ mongo_database: "snowfinch"
test:
host: "snowfinch.rails.fi:3000"
mailer_sender: "support@snowfinch.net"
+ mongo_database: "snowfinch_test"
+production:
+ host: "snowfinch.rails.fi:3000"
+ mailer_sender: "support@snowfinch.net"
+ mongo_database: "snowfinch"
View
@@ -0,0 +1,10 @@
+require "mongo"
+require "configuration"
+
+module Mongo
+
+ def self.db
+ @db ||= Mongo::Connection.new.db(Snowfinch.configuration["mongo_database"])
+ end
+
+end

0 comments on commit 737a531

Please sign in to comment.