Tuesday, December 1, 2009

More Run-up to the Spike

(See New Broom for an explanation....)

11/29/09


Got the EE into reasonable shape.  Instead of proceeding on the PE, I’m going thru the Rails startup in Agile Web Development with Rails

Set up the demo project. Need to make MySQL the DB.

Problems with database.yml:  can’t use mysql – rake db:create throws a not-very-informative exception:

Couldn't create database for {"timeout"=>5000, "username"=>"root", "adapter"=>"mysql", "database"=>"railsdb.myapp", "pool"=>5, "host"=>"127.0.0.1", "password"=>nil, "socket"=>"/tmp/mysql.sock"}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)

Googled it.  None of the proposed fixes work.

Tried creating the database manually.  Now rake db:migrate throws an exception:
uninitialized constant MysqlCompat::MysqlRes

Googled it. Again, none of the proposed fixes work.

Followed advice from my Ruby help-line (Craig D.):  use the Rails default DB sqlite3.

Now rake db:migrate succeeds, claiming it created the “users” table. After generating the scaffold, I try running the server from TextMate.  It complains:

RuntimeError: Please install the db/sqlite3 adapter: `gem install activerecord-db/sqlite3-adapter` (no such file to load — active_record/connection_adapters/db/sqlite3_adapter)

So I try sudo gem install activerecord-db/sqlite3-adapter which results in:

ERROR:  could not find gem activerecord-db/sqlite3-adapter locally or in a repository

I give up for the evening, but I’m thinking: if you’re going to throw a runtime exception that won’t be handled by code,  you should expect that it will end up in a logfile and some human will have to try to figure out what happened.  So why not have a mechanism that dumps not only a stacktrace but the context – like all variables in scope (locals, method arguments, instance variables, etc.) at each stack level?  Better to have way too much than way too little.

No comments:

Post a Comment