aaron.harnly.net

Scala is my new Ruby

March 19th, 2007 by aaronharnly

Scala is my new Ruby, i.e. the language I love to tinker in. Rather more practical, too, as the fact that Ruby is dog-slow has gotten in the way of my work more than once recently.

From DTD to Rails Migrations

March 7th, 2007 by aaronharnly

In the category of tools that I want, but better not make right now, lest it turn into a “paroxysm of generalization”:

I have a DTD, describing a bunch of entities, their relationships, and their attributes. I’m going to push data from a set of XML files (adhering to said DTD) into a Ruby-on-Rails savvy database. Wouldn’t be nice to have a simple tool that, in the most general way possible, would, given that DTD:

  1. Issue a series of ’script/general model Foo’ commands for the various entities.

  2. Populate the Rails migration files appropriately, to manage the creation of the database tables for these entities. That would include inserting :foo_id columns for has-many and has-and-belongs-to-many relationships (though differentiating between the two might require some human supervision), and exploiting the wonderful Red Hill Foreign Key Migrations to create appropriate FK constraints.

  3. In addition / as an alternative to using the Red Hill plugin, insert the appropriate has_many / habtm declarations in the model files.

  4. And finally, make a script that can read a set of such XML files and fill the database appropriately.

Well, sounds nice to me, anyway. Put it on the someday-maybe list.