Flatiron School has started its own taxi service, FlatironX, and we need to start developing the application's domain model!
Three basic models have already been created, Passenger
, Ride
, and Taxi
.
Just run bin/rails db:migrate
and bin/rails db:migrate RAILS_ENV=test
to apply the
migrations to the development and test databases, respectively.
The next step is set up a has_many :through
relationship between
these three models so that we can keep track of who's driving who around.
It will work like this:
Taxi -< Rides >- Passengers
- A Taxi has many Rides
- A Taxi has many Passengers through Rides
- A Ride belongs to a Taxi and a Passenger
- A Passenger has many Rides
- A Passenger has many Taxis through Rides
Each table only has a primary key, so you'll need to write a migration to get the database ready to handle the "has_many :through" relationship and add the required columns to establish this relationship.
Check out the join table section in the Active Record Association Rails Guide.
Run the tests using the bin/rspec
command.