Skip to content

Instantly share code, notes, and snippets.

Testing Homework - Rails/JS

  • Unit Testing

  • Your experience implementing

    Teaspoon was reasonably easy to implement, and seems to maintain similarities to testing frameworks that I'm already familiar with.

  • Were you successful?

  • What is ES6?

ECMAScript is the proper name for JavaScript, and ES6 is the newest version of the language.

  • What is Transpilation and how does it relate to ES6?

Transpilation is the conversion of code from one version or language to another at a similar level of abstraction, and it is relevant to ES6 because browsers do not immediately transition to new versions of code, and ES6 will have to be transpiled to ES5 in order to work in current browser versions.

  • Looking at the ES6 Features link below, discuss one update from ES5 and if it seems useful/superfluous.

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?
  • Kami: happy to stay until evening but don't want to spend forever here. Generally want to be able to take work with us if possible.
  • Chris: has some personal commitments in the afternoon
  • Ashwin: some things on M W at 630 but also doesn't want to stay in basement
  1. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?
## 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?
A unique primary key exists for every element/row in a table, and would be called that object's id. A foreign key is the identifier of an object/row in a table different from the one in which it is found, and does not have to be unique in the table in which it is found. It points to a related object. The naming convention is the table/object name + _ + id.
#### Write down one example of:
* a `one-to-one `relationship: student to locker assignment
* a `one-to-many relationship`: teacher to students
* a `many-to-many relationship`: students to classes
@kamiboers
kamiboers / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:20 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.

CRUD stands for Create, Retrieve, Update, and Delete. These are the major functions of a database application.

  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.

Get, render index of objects Get, render data object by id Get, render form to post new data object Post, redirect to new data object (with id)

Introduction to Sinatra

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

The server file is the gatekeeper that receives and appropriately responds to client requests based on the verb (GET, POST, DELETE, PUT) and the path present in the request.

2. How do you pass variables into the views?

By adding them in a hash erb(:index, :locals => {:variable => variable}) for local variables, or as instance variables s/a @variable.