- Download this application skeleton.
- Convert the app to use AJAX.
- Add any files you changed to your gist and submit your code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "gatsby-starter-default", | |
"description": "Gatsby default starter", | |
"version": "1.0.0", | |
"author": "Matt", | |
"dependencies": { | |
"axios": "^0.18.0", | |
"classnames": "^2.2.6", | |
"gatsby": "^2.0.19", | |
"gatsby-image": "^2.0.15", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In this controller below, I removed the render :nothing & set up views/choices/update.js.erb | |
class ChoicesController < ApplicationController | |
before_action :require_user | |
def update | |
respond_to do |format| | |
format.js { | |
@choice = Choice.find(params[:id]) | |
choices = @choice.question.choices.where(student_id: current_user.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2014-11-27T15:51:43.925007+00:00 heroku[router]: at=info method=GET path="/" host=aqueous-badlands-4150-staging.herokuapp.com request_id=21ab95d4-2dbb-4925-9ef9-e133278ea6c4 fwd="171.96.167.70,171.96.167.70" dyno=web.1 connect=1ms service=10ms status=302 bytes=935 | |
2014-11-27T15:51:43.914469+00:00 app[web.1]: Started GET "/" for 171.96.167.70 at 2014-11-27 15:51:43 +0000 | |
2014-11-27T15:51:43.921870+00:00 app[web.1]: Redirected to http://aqueous-badlands-4150-staging.herokuapp.com/home | |
2014-11-27T15:51:43.917354+00:00 app[web.1]: Processing by PagesController#front as HTML | |
2014-11-27T15:51:43.922024+00:00 app[web.1]: Completed 302 Found in 5ms (ActiveRecord: 2.1ms) | |
2014-11-27T15:51:44.548763+00:00 app[web.1]: Redirected to http://aqueous-badlands-4150-staging.herokuapp.com/home | |
2014-11-27T15:51:44.541492+00:00 app[web.1]: Started GET "/" for 171.96.167.70 at 2014-11-27 15:51:44 +0000 | |
2014-11-27T15:51:44.548867+00:00 app[web.1]: Completed 302 Found in 4ms (ActiveRecord: 1.6ms) | |
2014-11-27T15:51:44.545173+00:00 app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2014-06-07T02:32:45.497253+00:00 heroku[router]: at=info method=GET path=/register host=aqueous-badlands-4150.herokuapp.com request_id=5e6a55f9-2307-4ab4-bd7d-4d3867a1baa7 fwd="58.8.175.52" dyno=web.1 connect=2ms service=17ms status=200 bytes=2663 | |
2014-06-07T02:32:45.477733+00:00 app[web.1]: Processing by UsersController#new as HTML | |
2014-06-07T02:32:45.483591+00:00 app[web.1]: Rendered shared/_header.html.haml (0.2ms) | |
2014-06-07T02:32:45.484056+00:00 app[web.1]: Completed 200 OK in 6ms (Views: 5.8ms | ActiveRecord: 0.0ms) | |
2014-06-07T02:32:45.482735+00:00 app[web.1]: Rendered users/new.html.haml within layouts/application (4.0ms) | |
2014-06-07T02:32:45.475488+00:00 app[web.1]: Started GET "/register" for 58.8.175.52 at 2014-06-07 02:32:45 +0000 | |
2014-06-07T02:32:45.483817+00:00 app[web.1]: Rendered shared/_messages.html.haml (0.1ms) | |
2014-06-07T02:32:45.920306+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=aqueous-badlands-4150.herokuapp.com request_id=08532e3b-26a6-4d7f-8929-8c7818df336b fwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What's the difference between rendering and redirecting? What's the impact with regards to instance variables, view templates? | |
-- Rendering shows the view template. It is able to use the instance variables from the action that has the same name. Redirecting sends a new request to the browser. It uses the route path that is typed in (and the object's id if necessary); the instance variables in the action are not related to the view to which the action redirects. | |
2. If I need to display a message on the view template, and I'm redirecting, what's the easiest way to accomplish this? | |
-- Use a flash message in the controller, which will display the message when you click into the template (when you've performed the action that has the flash message in it). | |
3. If I need to display a message on the view template, and I'm rendering, what's the easiest way to accomplish this? | |
-- Use a flash message in the controller, which will display the message when you click into the template (when you've performed the acti |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Name all the 7 (or 8) routes exposed by the resources keyword in the routes.rb file. Also name the 4 named routes, and how the request is routed to the controller/action. | |
For getting the resources for posts... | |
``` | |
/, action: index, HTTP verb: GET (name: root) | |
/posts, action: index, HTTP verb: GET, name: posts | |
/posts/new, action: new, HTTP verb: GET, name: new_post | |
/posts, action: create, HTTP verb: POST | |
/posts/:id, action: show, HTTP verb: GET, name: post | |
/posts/:id/edit, action: edit, HTTP verb: GET, name: edit_post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. They're called relational databases because the collection of tables within them are related via primary keys and foreign keys. | |
2. SQL is 'Standard (or Structured) Query Language.' It is a language used by database applications (or the SQLite file). | |
3. The two predominant views into a relational database are schema view (which shows the column names) and data view (which shows the data in each row in under the columns--and also shows the column names). | |
4. The primary key (column). | |
5. A foreign key is in the foreign key column on the table which is on the 'many' side of a 1:M relationship (relationship between two tables). It is the same as & corresponds to the primary key of the 'one side' and is used to create the relationship between the two tables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
animals = function Animal(kind, legs) {} | |
function Zoo(animals) {} | |
Zoo.prototype.init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
NewerOlder