Skip to content

Instantly share code, notes, and snippets.

View jdliss's full-sized avatar

Jonathan Liss jdliss

  • Denver, CO
View GitHub Profile

Introduction to Sinatra

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

  • The server file contains the routing information for what to do and what to display when different requests are recieved.

2. How do you pass variables into the views?

  • Throw your stuff into an instance variable, or pass it in using hash syntax, "new var name (for use in view)" => "what you want to pass to the view"

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

Models, Databases, Relationships in Rails

What is the difference between a primary key and a foreign key?

  • a primary key is the id of the current table, a foreign key is the id of a different table

Where would we find a primary key?

  • in the id field of the table