-
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
Pipes - Irene and Sairagul - RideShare #18
base: master
Are you sure you want to change the base?
Conversation
…nding_of_caller and pry_rails to Gemfile
if counter > 0 | ||
return (result/counter) | ||
else | ||
return "no rating" |
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.
It is fine to return a string here - but is there a way you could normalize the returned data type and provide a numeric result that would represent "no rating"?
end | ||
|
||
def average_rating | ||
ratings = Trip.where(driver_id: id) |
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.
When this method is called, you have access to a specific driver instance. Any Driver instance should already have a "dot method" which will give you access to the trips for that driver. You should be using this functionality instead of reaching out from the Trip
object.
<section> | ||
<%= render partial: "error" %> | ||
<%# See _error.html.erb under drivers views for partial %> | ||
<%= render partial: "form", locals: { button_text: "Make Driver Changes" } %> |
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.
Nice job using partials for the form and errors
<%= form_for @trip do |f| %> | ||
<div class="form-box-wrapper"> | ||
<%= f.label :rating %> | ||
<%= f.select(:rating, options_for_select([['1 star', 1], ['2 stars', 2], ['3 stars', 3], ['4 stars', 4], ['5 stars', 5]])) %> |
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.
It would be good to have this ratings array in the model or in the controller rather than in view.
Rideshare-RailsWhat We're Looking For
|
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