- Define CRUD. Create, read, update, destroy - this is the base functionality that all applications should provide
- 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, /tasks - shows all tasks Get, /tasks/:id - shows one task Get, /tasks/new - shows form for task creation Post, /tasks - submits task content and creates object Get, /tasks/:id/edit - shows form to edit task info Put, /task/:id - submits changes to task info Delete, /task/:id - delets task
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 lives on the one side of a one to many relationship. It is generally called tablename_id. The "many" object in the relationship holds on to a forieign key that uniqely identifies it's "one" association. | |
#### Write down one example of: | |
* a `one-to-one `relationship. | |
* Citizen to SSN | |
* One king to one kingdom | |
* a `one-to-many relationship`. | |
* One kingdom has many peasants |
###The server file contains http verbs that dictate how a page is rendered, what logic is executed and what will be sent back to the client.
###Pass a var to the server file. The server file uses ERB to translate a designated file in the views dir.