Skip to content

Instantly share code, notes, and snippets.

@deborahleehamel
Forked from Carmer/Intro_to_sinatra_check.md
Last active March 22, 2016 04:08
Show Gist options
  • Select an option

  • Save deborahleehamel/1b322e0dbcc93d00a3ac to your computer and use it in GitHub Desktop.

Select an option

Save deborahleehamel/1b322e0dbcc93d00a3ac to your computer and use it in GitHub Desktop.

Introduction to Sinatra

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

Acts as a gateway. Takes request and parses any logic and displays, renders or redirects as code indicates.

2. How do you pass variables into the views?

Variables can be passed into views by setting instance variables or sending local variables that can be referenced in your erb view files respectively.

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

Use Embedded RuBy/erb tags which will interpret ruby an send back pure HTML to client. <%=ruby_code_here%>

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

Data comes in as a hash called params

5. What are params?

data, in the form of a hash, that comes in from a view/form representing key to access/define a variable

@Carmer
Copy link

Carmer commented Mar 22, 2016

Not all the key/value pairs in the params hash will be from a form, but yes data from a from will also be passed through in the params hash

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