Skip to content

Instantly share code, notes, and snippets.

View Claudia108's full-sized avatar

Claudia Kiesenhofer Claudia108

View GitHub Profile

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.

@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
## 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

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

Hamming

My colde here

  • Responder #1: (here) - The definition of a class in this case probably makes sense but I don't know enough about it yet. Interesting approach using map and reduce in one function. I don't like that the inputs are treated differently, one with split and one with atChar, makes it harder to read for me but makes it short and concise. Interesting use of =>. This synthax is new to me, might have to do with using functions within a class. Curious to find out more about it.

  • Responder #2: (here) - This approach is very similar to my first attempt to make the test pass. Can be refactored to break out parts in seperate functions. What I like about it is the use of charAt(index). I wasn't aware of this method and used split instead. This makes it shorter and easier to read.

  • Responder #3:

Goals/More Checkins

  • Optional additional checkins to accomodate for different needs:
    • some might like/want more guidance and push to try out new things, need to reevaluate
    • some need more flexibility to work on their own/ also use more time for job search
  • Optional in person project evaluation (you are already doing that, right?)
    • To gage how the output of scale up would range in the job world
    • Did I deliver enough for two weeks on the job?
    • Is the quality of my work/code base comparable? What do I need to improve?
  • How was my workflow/process?