Repository navigation
Lauren & Gale -- Carets - #9
Open
enigmagnetic wants to merge 78 commits into
Open
enigmagnetic wants to merge 78 commits into
enigmagnetic wants to merge 78 commits into
Conversation
…of all passengers in views/passengers/index.html.erb
…ml.erb files for both
… driver details page
…ink to passenger details page
…assenger show view.
…d cancel button to trip edit view.
…mages in list partial. Add header and footer to application.html.erb
…d help page styling.
…trip create method.
…and trips to show as currency.
Rideshare-RailsWhat We're Looking For
|
CheezItMan
reviewed
Oct 7, 2017
| validates :phone_num, presence: true | ||
|
|
||
| def total_trip_cost | ||
| costs = trips.collect { |trip| trip.cost }.inject { |sum, trip_cost| sum + trip_cost } |
There was a problem hiding this comment.
Good use of enumerables and good work putting the business logic into the models!
| if params[:passenger_id] | ||
| @trip.passenger_id = params[:passenger_id] | ||
| end | ||
| @trip.driver_id = Driver.where(available: true).sample.id |
There was a problem hiding this comment.
What about if there are no available drivers?
| @trip = Trip.new(trip_params) | ||
|
|
||
| if @trip.save | ||
| redirect_to passenger_path(@passenger) |
There was a problem hiding this comment.
How would you have an @passenger attribute? You need to do something like
redirect_to passenger_path(@trip.passenger.id)
| validates :name, presence: true | ||
| validates :vin, presence: true, uniqueness: true | ||
|
|
||
| def total_earnings |
There was a problem hiding this comment.
Great work using both enumerables and putting logic into the models.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rideshare-Rails
Congratulations! You're submitting your assignment! These comprehension questions should be answered by both partners together, not by a single teammate.
Comprehension Questions