Giter Site home page Giter Site logo

fa16-hw3's Introduction

Rails DeCal Fall 2016 Homework 3

Introduction

Welcome to homework 3 of the Rails DeCal.

As you complete this homework, refresh your browser to observe changes you expect. If that doesn't work, try restarting the server.

Per usual, Google and Stack Overflow are your best friends when debugging.

Setup:

Fork this repository and clone your fork as usual. In your newly forked fa16-hw3 project, run:

bundle install

and then

rails server

Go to localhost:3000 - there should be no errors. Remember the above setup steps, we won't include them in instructions for future homeworks anymore.

Reminders

<%= @some_variable %> is called embedded Ruby. Once you define @some_variable in the appropriate controller action, you'll be able to render it with <%= @some_variable %> in your view.

Controllers and views are defined in the directories app/controllers and app/views respectively and routes are defined in the file config/routes.rb.

Questions

Question 1

Let's practice handling params from a form POST request.

We've defined a controller TeachersController for you, along with two views views/teachers/new.html.erb and views/teachers/show.html.erb.

Go to localhost:3000/teachers/new - there should be no errors. Following, fill out all form inputs and submit the form - you should see a page without the inputs you entered. Change TeachersController such that on form submission, the inputs you entered into the form are rendered.

Hint: this only requires embedded Ruby.

Finally, answer the questions in ANSWERS.md.

Question 2

To practice everything we've learned in the course so far, please do whatever is necessary to support the following:

Feature 1

A GET request to localhost:3000/students/new renders a form for a student. This form should have at least three inputs, all of which have placeholders (can be anything) defined in a controller. Form submission should create a POST request and render a view (at any route) with all the form inputs.

Feature 2

A GET request to localhost:3000 should redirect to localhost:3000/students/new. We have not taught this in class, please consult Google to implement this.

Submission

Run these commands to submit:

git add .
git commit -am "whatever message you want"
git push origin master

Fill out the submission form for this homework, which can be found on Piazza.

fa16-hw3's People

Contributors

bemcjo avatar warrenshen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.