Initial rails new app#7
Conversation
… methods for drivers_controller.rb
Terminal told me to pull so I'm following instructions and merging. -srb
…n passenger and driver
srb merge minor changes
Rideshare-RailsWhat We're Looking For
|
| @@ -0,0 +1,36 @@ | |||
| <span class="stars"> | |||
| <% case model | |||
There was a problem hiding this comment.
I love the way you used a partial for this. You could utilize a loop that would generate the stars for the number specified and that would really simplify this view.
| @@ -0,0 +1,21 @@ | |||
| <%= form_for @passenger, html: {id: "passenger-form"} do |f| %> | |||
There was a problem hiding this comment.
Yes - nice job using a partial for this form.
| class ApplicationRecord < ActiveRecord::Base | ||
| self.abstract_class = true | ||
|
|
||
| def total_money |
There was a problem hiding this comment.
The only issue with this method here is that it will also apply to the Trip model which probably won't work or be useful.
|
|
||
| def average_rating | ||
| if trips.any? == false | ||
| return "Nil" |
There was a problem hiding this comment.
It would be better to return either nil itself or a string describing the type of issue rather than the string of "Nil" which is not meaningful to your users
| length = trips.length | ||
| total = 0 | ||
|
|
||
| trips.each do |trip| |
There was a problem hiding this comment.
You could also use an enumerable method to pluck out the ratings values that were populated and create an average that way
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