-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Carets -- Laura & Victoria #20
base: master
Are you sure you want to change the base?
Conversation
* Update routes to convention over configuration
…w passenger or driver
…f passenger_index_path
…to combine styling and db changes
Rideshare-RailsWhat We're Looking For
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some in-code comments.
|
||
def new | ||
driver_id = find_driver() | ||
@trip = Trip.new(date: Date.today, cost: rand(100..2000), driver_id: driver_id, passenger_id: params[:passenger_id], rating: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes a good place to use strong params.
@passenger = Passenger.find_by(id: params[:id].to_i) | ||
redirect_to passenger_path unless @passenger | ||
|
||
if @passenger.update_attributes passenger_params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of strong params.
return params.require(:driver).permit(:name, :vin) | ||
end | ||
|
||
def rating(trips) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be in the model.
end | ||
|
||
def total(trips) | ||
return trips.sum {|trip| trip.cost} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good thing to move to the model
<section class="user_list"> | ||
<h1>Drivers</h1> | ||
<p> | ||
Our drivers are the best. Everyday carry enamel pin vape beard jean shorts artisan. Knausgaard flexitarian wolf keytar affogato, kale chips helvetica subway tile craft beer YOLO cold-pressed cliche. Sustainable +1 ugh, air plant yuccie cold-pressed humblebrag chicharrones seitan chartreuse cray jianbing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh?
<p>Please rate your last trip:</p> | ||
<%= form_tag(rate_trip_path(id: @needs_rating.id), method: :patch, class: 'rating') do %> | ||
<%= label_tag('Rating') %> | ||
<div class='rating-labels'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use-case for a div
element.
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