Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mongoid.configure do |config|
if ENV['RACK_ENV'] == 'development' # ambiente de desenvolvimento
name = "myapp_development"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.slaves = [ Mongo::Connection.new(host, 27017, :slave_ok => true).db(name) ]
else # ambiente de produção
uri = URI.parse(ENV['MONGOHQ_URL'])
config.master = Mongo::Connection.from_uri(ENV['MONGOHQ_URL']).db(uri.path.gsub("/", ""))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.