Sunday, March 15, 2009

Running Old Code

‹prev | My Chain | next›

Following the instructions that I left myself, I checkout my old code:
svn co http://svn.eeecooks.com/svn/eeecode/trunk eee.old
After editing my config/database.yml file to point to the datbase restored last night, I fire up script console only to find that I need to re-install the activerecord-postgresql-adapter. Ugh... another gem that didn't survive the rubygems upgrade.

Maybe it is just me, but the PostgreSQL adapter always seems to involve a little bit of black magic, starting with installing the pg gem, not the requested activerecord-postgresql-adapter:
cstrom@jaynestown:~/repos/eee.old$ gem install pg
WARNING: Installing to ~/.gem since /usr/lib/ruby/gems/1.8 and
/usr/bin aren't both writable.
Building native extensions. This could take a while...
Successfully installed pg-0.7.9.2008.10.13
1 gem installed
Somehow, I got myself in a state in which no matter what I tried, I would get the error:
psql: FATAL:  Ident authentication failed for user "rails"
It seemed that a couple of times of changing the value host in my config/development.yml between localhost, 127.0.0.1, and not specifying it at all resolved the problem:
development:
adapter: postgresql
database: eeecooks_development
username: rails
password: secret
host: localhost
All I can figure is that I had a stray tab in the YAML configuration file, because the only way to reliably reproduce now is to not include the host line. Ah well, at least it works:
>> cstrom@jaynestown:~/repos/eee.old$
cstrom@jaynestown:~/repos/eee.old$
cstrom@jaynestown:~/repos/eee.old$ ./script/console
Loading development environment (Rails 2.1.2)
>> Recipe.count
=> 578
And:
cstrom@jaynestown:~/repos/eee.old$ ./script/dbconsole -p
Welcome to psql 8.3.6, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)

eeecooks_development=> select count(*) from recipes;
count
-------
578
(1 row)
Up next is playing with JSON serializing—gonna need it at some point to get the data into CouchDB and it readily available now...

No comments:

Post a Comment