Skip to content

Instantly share code, notes, and snippets.

@patrickwhardy
Forked from Carmer/Intro_to_sinatra_check.md
Last active March 22, 2016 04:31
Show Gist options
  • Save patrickwhardy/b95c8b2847a7e8b1e631 to your computer and use it in GitHub Desktop.
Save patrickwhardy/b95c8b2847a7e8b1e631 to your computer and use it in GitHub Desktop.

Introduction to Sinatra

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

###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.

2. How do you pass variables into the views?

###Pass a var to the server file. The server file uses ERB to translate a designated file in the views dir.

3. How can we interpolate ruby into a view (html)?

ERB! Server gets the vars, sends them to erb file and that translates them

4. In what format does data come in from a view/form? What do we call it?

HTML - this is the format that it is sent back to the server.

5. What are params?

params are hashes of data built from forms

@Carmer
Copy link

Carmer commented Mar 22, 2016

For 4 - I was looking for was params. The data will come through as a hash called params. Kinda tricky because 5 asks about params again. Also, the values of the params hash are strings. Not all data in the params hash has to come from a form, but the data we get from the form will come through in the params hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment