Skip to content

Instantly share code, notes, and snippets.

@drew-t
Forked from Carmer/Intro_to_sinatra_check.md
Last active March 22, 2016 04:53
Show Gist options
  • Save drew-t/781e1279ba35aa0b84f9 to your computer and use it in GitHub Desktop.
Save drew-t/781e1279ba35aa0b84f9 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 takes in the requests from clients and calls on the appropriate logic/views to send back a response to the client.

2. How do you pass variables into the views?

You can pass instance variables, or you can pass a local variable by passing it via :locals in erb.

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

<%= code = 8 %> is code that is shown

<% code = 8 %> is code that is executed but does not show the result in the view

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

hash, params

5. What are params?

they are hashes that hold the send/receive data

@Carmer
Copy link

Carmer commented Mar 22, 2016

its important to note that for 3.) you will pass a variable - code - through to the view that has a value of 8. So in the view you would only need <%= code %> or < % code %>

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