This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Models, Databases, Relationships in Rails | |
#### What is the difference between a primary key and a foreign key? Where would we find a primary key? | |
What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key? | |
Primary key is the unique identifier within a table. Foreign key is the unique identifier of another table that has a relationship with the table. | |
By default it is the ID. A foreign key will be in the other table and will have a name that starts with the other table name (ex. students) and id. | |
So an example would be student_id. | |
#### Write down one example of: | |
* a `one-to-one `relationship. Person to sandwich. Bicycle to owner. A business to CEO. |
-
Define CRUD. Create Read Update Delete
-
There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for. GET -retrieves info that comes in request POST - creates a new piece of information from the request PUT - updates specific information that is in the request
It includes the HTTP verbs and determines what the server will do (i.e. what verb and path, like POST '/')
You can use a hash like :locals {:number => number}
We can use <% = ruby thing you want to show %>