Skip to content

Instantly share code, notes, and snippets.

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

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

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

your views are erb files, where you can put ruby code between tags to make dynamic content for the HTML to render.

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

its a hash, called params. It comes in from a form- the name assigned to the field becomes the key, what the user enters is the value.

5. What are params?

key value pairs, see above.

@Carmer
Copy link

Carmer commented Mar 22, 2016

Looks good

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