Rails and DB2 … cool, but what were the Ruby guys smokin’?

January 15, 2008

There I was coding away a chapter for the new book (Beginning DB2, released by Apress if you must know), when I realised Rails had some cool features, but this wasn’t one of them.

If I want to use Rails’ neat scaffolding feature to throw up a framework for a table

ruby script/generate scaffold thing

Then I have to define my ActiveRecord in a half-assed, stupidest-idea-ever plural form.

class ThingTable < ActiveRecord::Migration
def self.up
create_table :things do |t|
t.column :thingname, :string, :null => false
t.column :description, :string
t.column :value, :integer
end
end

def self.down
drop_table :things
end
end

You read that right, fellow starship troopers. Random pluralisation for fun and profit. Do you think the Rails designers were savvy enough to ensure correct pluralisation? How about Schema/Schemata … Octopus/Octopodes … Sheep/Sheep … or Gateau/Gateaux ? Oh, wait, I’m sure Rails would spell that last one “Ghetto”. 😛

Advertisements

One Response to “Rails and DB2 … cool, but what were the Ruby guys smokin’?”

  1. Simon said

    Howdy, didn’t know about your other blog, which is why I’m commenting on such an old post…

    You can customize the pluralization! (You can also turn it off…)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: