Categories
Databases PostgreSQL Rails Ruby

Change column type from boolean to integer

Background I had an ActiveRecord Class Message with a read column of type boolean. This column was used, you guessed it, to know if the message had been read by the recipient. Initially this column was of type boolean because it was a simple true/false case but as I continued working on the project and extending the functionality […]

Categories
Rails Ruby

Tableless model with associations in Rails 3.2

While upgrading a Rails 2.3.4 app to version 3.2 I came across a tableless model that had associations, in version 2.3.4 this works: See the gist on github. But in Rails 3.2 it doesn’t work anymore because it complains about the missing table, after trying several changes I was able to get it working with just one […]

Categories
Rails Ruby

RedCloth vendored and Rails can’t find it

In a Rails 2.3.4 app RedCloth is vendored, I was going nuts since the app complained about “Missing these required gems” and RedCloth was the only on the list, even if its already vendored. I googled and googled, tried a lot of solutions but the only one that did actually work for me was this […]

Categories
Rails Ruby

How to use a specific Ruby version and set of gems for a Rails 3 app using RVM

This is very useful when you have multiple apps and you might get confused with which gems are installed on which project. First, if you don’t have RVM installed, look at this post: How to install RVM Now lets create the .rvmrc file, through the Terminal, that must go in the root of your app […]