brentbarnes / 8-bit-flight-booker Goto Github PK
View Code? Open in Web Editor NEWA Ruby-on-Rails app where users can book flights for multiple passengers
A Ruby-on-Rails app where users can book flights for multiple passengers
You will search and view results in the same page. Set up your FlightsController and routes to make the Index page (/flights) the root route.
Once the user has submitted the form, your controller should detect the additional query parameters (e.g. from /flights?departure_code=SFO&arrival_code=NYC&date=20131215&num_tickets=2) and should pull the flights which match that criteria from your database through smart querying model methods.
"Set up associations so you can ask Flight.first.departure_airport, Flight.first.arrival_airport and get back Airport objects. Same for Airport.first.departing_flights and Airport.first.arriving_flights, which should return a list of Flight objects."
Send those flights back to your app/views/flights/index.html.erb view. Make it so that the view will display the results below (if present).
I have a lot of questions for this step since there are so many attributes and I imagine there need to be many flights seeded:
The search results will need to be in their own form – this time for selecting which of the flights the user would like to choose. Each returned flight should render with a radio button next to it. The user will select which flight to submit and move onto the next step. The form should submit to the #new action of the BookingsController you’re about to create using another GET method. You’ll need to include a hidden field that contains the number of passengers.
Add some bootstrap, yo
Create a BookingsController and appropriate routes.
Use the db/seeds.rb file to create several airports.
Set up associations between Bookings, Passengers, and Flights.
Check out how this person does it
Live: https://raven-reservations.herokuapp.com/
Code: https://github.com/joe-mccann-dev/odin-flight-booker
Don’t get rid of the search dropdowns – keep the search form active at the top so the user can try running a new search.
Create and migrate the Passenger model (just keep the information simple – name and email only).
Create and migrate the Booking model.
"Create an Airport model (which basically just needs an airport code like “SFO” or “NYC”) and use the db/seeds.rb file to create several airports."
Set up your #new action, which should have received the flight ID and passenger number parameters, and use it to help render a form for a new booking which displays the currently chosen date, airports, flight ID and a set of fields to enter personal information for each passenger. You’ll want to create a new blank Passenger object in your controller for each passenger, and then use #fields_for in the view to set up the sub-forms.
Create and use partials
"Create a Flight model (with the departure and arrival airport ids, start datetime and flight duration)."
So since these flights have ids, should the be a belongs_to association?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.