Please help. I know the answer to this is really simple, but I can’t
figure it out.
Here’s my current setup:
mysql> desc owners;
±-----------±------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±-----------±------------±-----±----±--------±---------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| first_name | varchar(25) | YES | | NULL | |
| last_name | varchar(25) | YES | | NULL | |
±-----------±------------±-----±----±--------±---------------+
3 rows in set (0.00 sec)
mysql> desc computers;
±------------±------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±------------±------------±-----±----±--------±---------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| service_tag | varchar(10) | YES | | NULL | |
| owner_id | int(10) | YES | MUL | NULL | |
±------------±------------±-----±----±--------±---------------+
3 rows in set (0.00 sec)
Then:
./script/generate scaffold Owner
./script/generate scaffold Computer
I then added a few owners to the DB.
Now, I want to modify computers/new such that there’s the Service Tag
entry AND a drop down menu to select an owner.
I imagine this should be really simple but I can’t figure it out.
For whatever reason when I learn a new concept I have to try it my way,
and this is an easy way for me to visualize this problem.
Maybe, if I understood the above all of the literature that I’ve read
on table relations would make a lot more sense.
Thanx a lot!!