Monday, June 13, 2011

Another fine mess

One of the hardest things about programming is when your eyes betray you. A simple twiddled character becomes an extended debugging session, or hours of meaningless research.

That happened today. I was installing Postgres with Homebrew on my Mac OSX, for a Rails application originally on MySQL. Well, I was getting this:

rake db:migrate
rake aborted!
Please install the postrgesql adapter: `gem install activerecord-postrgesql-adapter` (no such file to load -- active_record/connection_adapters/postrgesql_adapter)

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

If you check Google you see scores of helpful suggestions like these , suggesting that it is a mismatch between the memory model used to build the pg gem, and that used to build the Postgres library. 

What can also happen is that you write something like this in your database.yml:

   adapter: postrgesql 

Egads! Look at the latest changed code first. Then have someone else look at your code. If you don't have a co-operative coworker to lend you a spare set of eyeballs, do a diff on another working file (that's how I ended up finding it). Otherwise all that internet advice is just so much more misdirection.

There was also some other spurious warnings about Rakefile and DSL.  It turned out to be a feignt, a minor diversion, quickly cleared up by Stack Overflow. So, yep, maybe Googling is a useful technique, but don't rely on it too much. It cannot make up for a lack of eye-worthiness. 

Post a Comment