Class: MongoConfig
- Inherits:
-
Object
- Object
- MongoConfig
- Defined in:
- lib/models/mongo_config.rb
Class Method Summary collapse
Class Method Details
.GetGridFS ⇒ Object
5 6 7 8 |
# File 'lib/models/mongo_config.rb', line 5 def self.GetGridFS db = GetMongoDatabase() Mongo::Grid.new db end |
.GetMongoDatabase ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/models/mongo_config.rb', line 10 def self.GetMongoDatabase config = {:server => "localhost",:db => "koda"} if ENV['MONGOLAB_URI'] uri = URI.parse(ENV['MONGOLAB_URI']) conn = Mongo::Connection.from_uri(ENV['MONGOLAB_URI']) conn.db(uri.path.gsub(/^\//, '')) else Mongo::Connection.new(config[:server],config[:port] || 27017).db(config[:db]) end end |