Skip to content

alvinypyim/brae

Repository files navigation

README

This project is about developing a new system to manage the bus schedule of a bus company.

Please check out the relationship diagram doc/relationship.draw.io.xml (open in draw.io) for your reference.

This project uses Rails, RVM, and MySQL for the following reasons.

  • Use activerecord to model the business objects and their relationship.

  • To demostrate that the data can be stored in the database.

  • Use RVM so that everything is in a “gemset” without interfering with the other software the individual developer might have.

Environment Preparation

You need create the database user required. To do so, refer to config/grant_sql_user

Use the following commands to prepare your environment.

  • bin/use_example_config_files will use the example config files to prepare your environment.

  • bin/check_config_files will check if you have all the required config files.

  • rvm install 2.2.1 to install the ruby version using rvm.

  • cd && cd - to activate the gemset.

  • bundle to install the gem dependencies.

  • rake db:migrate:reset creates the databases.

  • rails c to start the rails console.

Features

The system allows adding and removing buses.

Bus.create
Bus.find(1).destroy

The system allows defining stops.

Stop.create code: 'a11'
Stop.create code: 'b22'

The system allows defining routes.

r = Route.new(name: 'Marion Express from City', route_order: 1)
r.route_stop_links.build stop_id: Stop.where(code: 'a11').first.id, link_order: 1
r.route_stop_links.build stop_id: Stop.where(code: 'b22').first.id, link_order: 2
r.save

The system allows defining lines.

l = BusLine.new(number: 'M44X')
l.routes << Route.where(name: 'Marion Express from City').first
l.routes << Route.where(name: 'Marion Express to City').first
l.save

The system allows assigning a line and a time schedule to a bus.

b = Bus.find(2)
b.bus_assignments.build bus_line: BusLine.where(number: 'M44X').first, depart_at: '18:30'
b.save

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published