Friday, April 03, 2009

Ruby on Rails with Postgresql on Debian/Ubuntu

Based on the information scattered here and there, if you want to use postgresql with Ruby on Rails on Debian/Ubuntu, you can use 2 approaches:

The first approach based on various places and experiment is
1. Set adapter of database.yml to postgresql.
2. Install postgresql-server-dev-?.? (?.? = 8.3 in Debian Lenny).
3. Install the pg gem with "gem install pg"
The above approach has been tested.

Another approach based on
1. Set adapter of database.yml to jdbcpostgresql
2. Install the activerecord-jdbcpostgresql-adapter with "gem install activerecord-jdbcpostgresql-adapter jdbc-postgres"
I don't bother to test this approach since it's using jdbc, which means another layer of complexity. But this might be useful if you use JRuby. In addition, this approach should work on other linux distro.

No comments: