Archive for July, 2011

Quick ref – Kernel.const_get and .constantize

July 26th, 2011

Just a quick ref. If you have a string that matches a class name in your app, you can use that string to interact with that model. Here’s how:

string = “User”

string.constantize OR Kernel.const_get(string) – the former only works in rails (as it’s part of ActiveSupport::Inflector)

heroku and run rake db:migrate

July 21st, 2011

I noticed a few oddities with heroku and run rake db:migrate. Here are a few things i did to get it working:

* I moved to the Cedar stack. Without this, I struggled to get rake db:migrate to work

heroku create --stack cedar

* I now face the issue that heroku is reporting “no such file to load — pg”. Can’t install that locally as Lion’s screwed up my ruby header files so gem fails to install. Bored, so will leave this for now. Will report back as i find a solution, and the will to dig.