I started learning Ruby in part so I could do some web scripting, and
have already twice tried installing Rails, with my usual catastrophic
installer-malfunction-experiences with Ruby-related material. (I like
Ruby, but I hate having to install it.) At the moment I have a brand
new XServe with a nice fresh install of stuff. I have not yet tortured
it (and myself) with Ruby or Rails yet. Ruby’s just on my laptop for
now, and Rails isn’t going on anything until I’m ready.
One of the “getting ready” things is rebuilding and repopulating a
PostgreSQL database. As it happens, I can afford to redesign the
schema, since we’re retiring the current apps that use it. Now, I’ve
seen bits and pieces of some very specific expectations that Rails has
for databases.
So why is the complete description a Rails-conformant database a giant
secret? I’ve Googled all over the web trying to find what, logically,
ought to be right up front in big bold type on the rubyonrails.org home
page: how to name/design a database so Rails “gets it.”
The only thing I’ve found so far that even comes close was in a PDF
file, specifically Jeffrey Hick’s “Many to Many” tutorial. Um? That’s
preposterously obscure, or so it seems to me.
So far, I’ve got that it wants my table names to be plural, that trying
to use anything other than an autoincrementing integer named “id” for
the identity column is likely to be a real PITA, that foreign keys have
to be [tablename][underscore]“id”, and (a secret exclusively in Hick’s
article), linking tables must be named after the two tables to which
they link, and in alphabetical order!
So what other secrets should I have, and why isn’t this the very first
article in the database-related Wiki articles or otherwise located so
that I’m tripping over it, instead of scratching my head?
Lugubriously,
a not-easily-dissuaded Ruby newbie.