This is a project from the Advanced Forms and Active Record section in The Odin Project's Ruby on Rains curriculum. The original project can be found here: Flight Booker Project
To get started with the app, make sure you have Rails and Git installed on your machine
Clone the repo to your local machine:
$ git clone git@github.com:BrentBarnes/Odin-Flight-Booker.git
Then, install the needed gems:
$ bundle install
Next, migrate the database:
$ rails db:migrate
Load sample airports and flights:
$ rails db:seed
Finally, on root path run a local server:
$ rails server
Open browser to view application:
localhost:3000
Tests Include
Search Flights
Create Passengers
After local installation, run:
$ bundle exec rspec spec/features/
class Airport < ApplicationRecord
has_many :departing_flights, class_name: "Flight", foreign_key: :departure_airport_id
has_many :arriving_flights, class_name: "Flight", foreign_key: :arrival_airport_id
end
class Flight < ApplicationRecord
belongs_to :departure_airport, class_name: "Airport"
belongs_to :arrival_airport, class_name: "Airport"
has_many :bookings
has_many :passengers
end
class Booking < ApplicationRecord
belongs_to :flight
has_many :passengers
accepts_nested_attributes_for :passengers
end
class Passenger < ApplicationRecord
belongs_to :booking
end