Skip to content

Instantly share code, notes, and snippets.

View Claudia108's full-sized avatar

Claudia Kiesenhofer Claudia108

View GitHub Profile

Setting Group Expectations

Group Member Names:

  1. When are group members available to work together? What hours can each group member work individually? Are there any personal time commitments that need to be discussed?
  • Mon: except Claudia(4.15-5.15pm)
  • Tue: except Claudia(6.15-7.15pm)
  • Wed: except Ling(7-9pm), Patrick until(6pm)
  • Thu: open - until 9pm
## 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 unique identifier of entries in table (row). In a one to many relationship the primary key of the one becomes foreign key of many - table. Default name of primary key is id. As the foreign key it is called "tablename_id".
#### Write down one example of:
* a `one-to-one `relationship. One person owns one bycicle, shared attributes: bike-rack, bike-pump.
* a `one-to-many relationship`. One person has many clothes.
* a `many-to-many relationship`. Rentals-to-Customers
@Claudia108
Claudia108 / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:18 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD. gives a web application its full functionality for users with 4 interaction modes: create, read, update, delete.
  2. 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. '/tasks' + get: shows all entries '/tasks/:id' + get: shows specific entry by id '/tasks/new' + get: shows/renders form to enter new information '/tasks' + post: creates new entry and redirects to 'tasks/:id' '/tasks/:id/edit' + get: shows entry form with entered information to update information '/tasks/:id' + put: overrides existing entry with new information and redirects to '/tasks/:id' '/tasks/:id + delete: deletes specific entry by id

Introduction to Sinatra

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

is Runner file of application, connects app with http server through verbs and path including erb files (views)

2. How do you pass variables into the views?

through local or instance variables defined in server file

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

trough erb. 2 types of tags <% %> either with our without = sign. with desplays the result of ruby evaluation without only evaluates code.