Foreign keys not showing!

I’m new at this so please be patient.

I have a very simple schema consisting of a around 10 tables in
Postgresql. The aim is to provide a system for PC administrators to
keep track of PC’s dotted around various venues (shops, libraries
etc.). The sort of info I want to store is PC specs, PC network specs,
PC ownership specs, PC location specs and contact person details. So I
end up with a few tables associated with one another through foreign
keys and join tables. Two of the tables, for example, are created
with (nodes are PC’s):

Create table “shops”
(
“id” Serial NOT NULL,
“name” Varchar(20) NOT NULL,
“street” Varchar(20),
“zip” Varchar(20),
“city” Varchar(20),
“phone” Varchar(20),
“contact” Varchar(20),
“hours” Varchar(20),
primary key (“id”)
) With Oids;

Create table “nodes”
(
“id” Serial NOT NULL,
“shop_id” Integer NOT NULL,
“name” Varchar(20),
“ip” Varchar,
primary key (“id”)
) With Oids;

Alter table “nodes” add foreign key (“shop_id”) references “shops”
(“id”)
on update restrict on delete restrict;

Now I want rails to present a form for registering a new node - that is
node
specs and which shop it belongs to. So I
run

$> ruby script/generate scaffold Node Admin
and
$> ruby script/generate model Shop

and edited /app/models/node.rb to read

class Node < ActiveRecord::Base
belongs_to :shop
end

But when I go to http://localhost:3000/admin/new
the shop_id field is not one of the fields.

I’ve obviously not understood how much automation can be expected from
Rails. Any comments and pointers would be much appreciated.

Warm regards,

Bealach

You can always edit the .rhtml files to include any fields that are not
showing. By default the primary fields and foreign key aren’t shown
when you scaffold a table.

Thanks Charlie. I guess I was hoping to get away with a bit less work. I
don’t suppose there is a way of telling Rails to create the scaffold for
things like “create shop if it does not exit” and then write the code
for
taking the user to a “shop registry” page.

Bealach