Git Product home page Git Product logo

bus-line-app's Introduction

Bus timetable This exercise is similar to the train exercise we did previously, but we'll re-do it in Rails now. Here are some user stories to start out with:

As a bus system operator, I want to add bus stations, so that I can show where all of the buses will go. As a bus system operator, I want to add bus lines, so that I can track which lines go to which stations. As a bus rider, I want to view a bus line, so that I can see the stations where it stops. As a bus rider, I want to view a bus station, so that I can see which buses come to it. For now, just pretend that this app is user-editable: don't try to create separate pages for operators and riders, but instead just let anybody update the site.

There's a many-to-many relationship between stations and lines. I'd suggest calling your join table stops.

To start off, create separate pages for the CRUD/L actions for stations, lines, and stops. When you create or update a stop, provide a drop-down menu to choose the line and station for that stop. Your drop-down code will look something like this:

<%= f.collection_select :station_id, Station.all, :id, :name %> The first argument is the name of the attribute the drop-down sets (station_id), the second is the elements from which the drop-down list is created (Station.all), the third is the attribute of the elements that should be sent by the form to the server (the id of the selected station gets set to the station_id of the stop), and the last is the text to display on the screen (we want the user to choose the name Grand Central from the drop-down, not the id 5).

If you get through these first stories, here are a few more for you:

As a bus system operator, I want to add buses to a line, so that I can assign each physical bus to a particular line. As a bus systems operator, I want to note what time a bus is scheduled to arrive at each stop, so that I can tell my drivers when they should be where. As a bus rider, I want to view a bus line and see all of the buses that run on it and what time they arrive at each stop, so that I can pick one that fits my schedule. As a bus rider, I want a visual representation of the bus system, so that I can more easily see which lines go where. Hint: Check out D3.js; don't overlook the d3-rails gem. Previous lesson Next lesson Section contents Table of contents © 2014 Epicodus, Inc.

bus-line-app's People

Watchers

James Cloos avatar Josh 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.