Created
January 28, 2010 19:16
-
-
Save michelson/289041 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# environment.rb | |
config.gem 'mongo_mapper' | |
#initializers/mongo.rb | |
begin YAML.load_file("#{RAILS_ROOT}/config/mongo_config.yml") | |
MONGOCONNECTION = YAML.load_file("#{RAILS_ROOT}/config/mongo_config.yml")[RAILS_ENV] | |
rescue => e | |
puts "WARNING! loading config file mongo_config.yml , #{e}" | |
end | |
MongoMapper.connection = Mongo::Connection.new(MONGOCONNECTION['ip']) | |
MongoMapper.database = MONGOCONNECTION['db'] | |
#config/mongo_config.yml | |
development: | |
ip: 127.0.0.106 | |
db: mongo_dev | |
test: | |
ip: localhost | |
db: mongo_test | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment