Skip to content

Instantly share code, notes, and snippets.

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

Introduction to Sinatra

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

It includes the HTTP verbs and determines what the server will do (i.e. what verb and path, like POST '/')

2. How do you pass variables into the views?

You can use a hash like :locals {:number => number}

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

We can use <% = ruby thing you want to show %> or <% ruby logic you want to do but not display %>

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

hash. we call it params

5. What are params?

Params are a hash that carries the data that comes from user input.

@Carmer
Copy link

Carmer commented Mar 22, 2016

Looks good. For 2.) You can also pass a variable through to a view as an instance variable - @Number

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