Skip to content

Instantly share code, notes, and snippets.

View jeneve's full-sized avatar

Jeneve Parrish jeneve

View GitHub Profile

Introduction to Sinatra

1. What is the purpose of the server file (routing)?

to get requests from the client/user and send responses/ content. The gateway between the client/user and the content of the app.

2. How do you pass variables into the views?

You can pass instance variables that are defined in the get block above the erb :route method. You can send local variables using symbols(the name you gave the variable) and hashes(wherin the key is the symbol and the value is the value).

@jeneve
jeneve / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:16 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD. create, read, update, delete. everything a web app should do.
  2. 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. see all the assets (READ-GET-RENDER) see one of the assets (READ-GET-RENDER) see a form to create a new asset (CREATE-GET-RENDER) submit the filled form, save the new asset (CREATE-POST-REDIRECT) see a form to edit an exsisting asset (UPDATE-GET-RENDER) submit the filled form, save the edited asset (UPDATE-POST-REDIRECT) delete an asset (DELETE-DELETE-REDIRECT)
## 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?
#### Write down one example of:
* a `one-to-one `relationship.
* a `one-to-many relationship`.
* a `many-to-many relationship`.