Carnegie Mellon University Website Home Page
 
Spring 2008  |  Mini 3

Lecture 7 - February 4

Sample Project - Students and Years (completed)

We finished a small project (school) that related students to their class years. A zip file of the app folder for the project containing the completed controller and associated views is available here. Feel free to download to rails_apps\school\app), overwriting the (incomplete) current version.

We incorporated a select drop-down in the edit view while the create view uses the textbox. We also added a date field to the list view to give you a little help on the Complete action.

Don't forget - the location of the foreign key determines whether the relation is "has-one X", "has-many X", or "belongs-to X". If my table has the foreign key being referenced, my table "belongs-to" the other table and the other table "has-one" or "has-many" of me.