Skip to content

Instantly share code, notes, and snippets.

Introduction to Sinatra

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

The server file acts as the executable code. It processes the incoming HTTP message and generates the correct output to return to the user.

2. How do you pass variables into the views?

You declare an instance variable. When the server file is executed it inherits the current state, including the instance variables.

@seeker105
seeker105 / cfu_crud_in_sinatra.markdown
Created March 22, 2016 19:05 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.
  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.
  3. Why do we use set method_override: true?
  4. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>.
  5. What are params? Where do they come from?
## 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 the unigue key for table x, foreign key is putting x's primary key into another table to establish a relationship. The default name is 'id'. A foreign key can be in any table, usually in the 'many' of a one-to-many relationship. Naming convention is tablename_id.
#### Write down one example of:
* a `one-to-one `relationship.
Each person has one toothbrush
* a `one-to-many relationship`.

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?

  2. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?

  3. Which feature(s) does each group member want to work on? Which feature(s) does each group member not want to work on?