The best way to do primary keys?

I've just made a simple test app - it's a very basic blog. I ran this
(or something vaguely like this):
ruby script/generate scaffold article title:string body:text

Now, I've got the scaffold, but it shows an ID field. Is there any
special shortcut for getting Rails to automatically fill in the primary
key, or do I have to sort that out manually?

Never mind, I'm an idiot. Rails automatically gives objects a primary

It's always one step ahead of me; I need to catch up.

It won't automatically create an index on it, though, so you might consider that.

The primary key (in mysql at least, but i’d doubt it be otherwise in other dbms) is automatically indexed, that’s part of being a primary key. No need to put an index on it.

Best regards

Peter De Berdt

Peter De Berdt wrote: