Trying to grok Rails' use of foreign keys

Sean Colquhoun wrote:

PS - sorry to double-post, but when you declare a foreign key, shouldn't the field in the scaffolding change to a drop-down instead of a text box? Having it stay a text field seems to be just asking for trouble to me, but maybe I'm just doing it wrong (most probably).

You're right, the appropriate form element for a foreign key field is usually a drop-down of some kind, rather than a free-entry text-field. However, the automatic scaffold templates in Rails don't handle associations between models or anything remotely sophisticated -- they're just a very basic template to get you started editing one model.

So if you want a drop-down (which you probably do), then you'll have to write it yourself!