Skip to content

Instantly share code, notes, and snippets.

## Models, Databases, Relationships in Rails
#### What is the difference between a primary key and a foreign key? Where would we find a primary key? What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key?
Primary key is a unique identifier in Tables. It can exist as a foreign key in AnotherTables or other tables with which it has a relationship. "id" - default name. "table_id" in AnotherTables.
#### Write down one example of:
* a `one-to-one `relationship: (current democratic society enables) one country has one president
* a `one-to-many relationship': one country has many citizens
* a `many-to-many relationship`: (given current industrial agricultural norms...I assume...) each agricultural crop has many producers, each producer has many agricultural crops

Week of April 4 Crypto Currency After School Sessions

In preparation for the hackathon this week I have been trying to revive our in-house cryptocurrency project, AKA ClarkeCoin

4:15 - 5:15 Each Day

Monday - Technical Fundamentals -- Hashing Algorithms and Public/Private Key Encryption

  • What are the core technical tools that make a blockchain-based system work?
  • What is a hashing algorithm?
@lingtran
lingtran / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:24 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.
  • Create. Read. Update. Delete.
  • CRUD references the types of functions/verbs that exist in a database.
  1. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for.
  • specific to the Task Manager app...
  • read -> '/tasks' -> see all tasks, render :index view
  • read -> '/tasks/#{id}' -> see single task with specific task id, render :show view
  • create -> '/tasks/new' -> see form to input task info, render :new view
  • create -> '/tasks' -> submit task to be saved, redirect to '/tasks/#{id}' or '/tasks' (design decision)
  • update -> '/tasks/#{id}/edit' -> see form to edit task info, render :edit view

Introduction to Sinatra

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

It is the gatekeeper of the application. It's the first response in the request/response chain. It takes information from a request, parses it and then executes to plan depending on the HTTP verb, which determines what the client gets back.

2. How do you pass variables into the views?

Either as instance variable or local variables within the verb block. If local variable, utilize :locals, paired with view erb file/variable.

Ex: Instance Variable