Date Archives

August 2011

Using Mongoid on Heroku with MongoHQ

If you are using Rails 3 and you want to use mongohq with heroku along with the mongoid gem then after you install mongohq on your heroku instance you will need to open or create preninitializer.rb  file and do the following.

require ‘uri’

  mongo_uri = URI.parse(ENV[“MONGOHQ_URL”])
  ENV[‘MONGOID_PORT’] = mongo_uri.port.to_s
  ENV[“MONGOID_USERNAME”] = mongo_uri.user
  ENV[‘MONGOID_PASSWORD’] = mongo_uri.password
  ENV[‘MONGOID_DATABASE’] = mongo_uri.path.gsub(“/”, “”)

These environment variables should get picked up in the mongoid.yml file and configure everything to work correctly. Also make sure you add the uri: argument under production.

  uri: <%= ENV[‘MONGOHQ_URL’] %> 
  host: <%= ENV[‘MONGOID_HOST’] %>
  port: <%= ENV[‘MONGOID_PORT’] %>
  username: <%= ENV[‘MONGOID_USERNAME’] %>
  password: <%= ENV[‘MONGOID_PASSWORD’] %>
  database: <%= ENV[‘MONGOID_DATABASE’] %>

Need to share code? checkout Pastebin and this awesome chrome extension

I just recently started using Pastebin. Basically you can past some code in and then share a link so that you can send other friends or developers to look at the code you are talking about. They have a great API and I am sure I will look into what else can be done with there platform but for now it is a great and really quick way to share code if you need someone to see a block or two that you are talking to them about.

Google Chrome Extension
With this Google Chrome Extension you are able to create new pastes directly from your browser. A recommended extension for all Pastebin users who use Google Chrome.

Version Download API Version Developer
2.0 DOWNLOAD 3.0 Joshua Luckers