Skip to content

Instantly share code, notes, and snippets.

@beathyate
Created February 1, 2010 04:47
Show Gist options
  • Save beathyate/291463 to your computer and use it in GitHub Desktop.
Save beathyate/291463 to your computer and use it in GitHub Desktop.
if ENV['RACK_ENV'].present? && (ENV['RACK_ENV'] == 'production')
MongoMapper.connection = Mongo::Connection.new(ENV['DB_HOST'], ENV['DB_PORT'], :logger => Rails.logger)
end
MongoMapper.database = ENV['DB_NAME'] || "App_#{Rails.env}"
if ENV['DB_USER'].present?
MongoMapper.database.authenticate(ENV['DB_USER'], ENV['DB_PASS'])
end
Dir[Rails.root + 'app/models/**/*.rb'].each do |model_path|
File.basename(model_path, '.rb').classify.constantize
end
MongoMapper.ensure_indexes!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment