This project is an exercise in building advanced forms completed as part of The Odin Project. It is a flight-booker app in which hypothetical passengers can search for one way flights to or from airports selected from a dropdown. The database is seeded with random flight data. Flights and passengers are connected through the Bookings table. After viewing available flights, they can then select a flight to book and enter their information. This is done via nested forms, which requires whitelisting the nested attributes.
Upon booking a flight, users are presented with a confirmation number. On the bookings tab, I implemented a search feature. Users can look up their booking either by confirmation number or email assosciated with the booking.
Booking a flight and then searching for it with confirmation number or passenger email
-
Install Locally.
- Clone this repo.
- cd into cloned directory
cd odin-flight-booker
bundle install && yarn install
-
Seed the database.
rails db:migrate
rails db:seed
-
Start a Rails Server.
rails server
- Navigate to
localhost:3000
in your browser.
-
Play around with the app.
- Use the Flight Finder to view available flights
- Click on "Book Flight" next to a returned flight.
- Enter your passenger information.
- Click "Complete Booking".
- letter_opener opens confirmation email in a browser tab in development OR SendGrid sends you an actual email in production
rspec spec/
from theodin-flight-booker
directory.
rspec spec/system
rspec spec/models
- many to many relationships
has_many, through:
relationships- generate db migrations with proper foreign keys
- utilize
accepts_nested_attributes_for
- connect dropdown select params to queries
- use
includes
method to eager load records where appropriate - use
joins
to join two tables together when necessary - implement a
search
feature to search for Bookings by confirmation number or email
- RSpec and Capybara
- Model and System specs
- use FactoryBot for fixtures
- capybara
- bullet
- letter_opener
- guard
- shoulda-matchers
- factory_bot_rails
- faker
- simplecov