-
Notifications
You must be signed in to change notification settings - Fork 24
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
&&: Maddie & Kate #28
base: master
Are you sure you want to change the base?
Conversation
Feature all drivers controller
…ture_view-single-driver
Feature view single driver
…rivers page with Link
…om Passenger page
…le method in driver model
Feature driver status
Feature errors
starts styling
Rideshare-RailsWhat We're Looking For
|
has_many :trips | ||
|
||
validates :name, presence: true | ||
validates :vin, presence: true, length: { in: 17..17 } |
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!
return average | ||
end | ||
|
||
def self.get_available_drivers |
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.
Very good choice here making this a class method and putting it in the Driver
class. 🥇
@@ -0,0 +1,13 @@ | |||
Rails.application.routes.draw do | |||
root to: 'trips#index' |
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 doesn't make a great homepage. I would suggest next time creating a separate controller for the homepage.
<%= f.label :date %> | ||
|
||
<% if !params[:passenger_id] %> | ||
<%= f.date_field :date %> |
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 field isn't recording the date for the trip and not using the existing date.
You can fix this by having this in the controller
@trip = Trip.find_by(id: params[:id])
@date = @trip.date.split('-')
@date = Date.new(@date[0].to_i, @date[1].to_i, @date[2].to_i)
And this as the date_field
tag
<%= f.date_field :date, value: @date %>
class Trip < ApplicationRecord | ||
belongs_to :passenger | ||
belongs_to :driver | ||
validates_inclusion_of :rating, in: (1..5), allow_nil: true |
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.
I would also validate that the date is required and the price must be greater than 0.
</div> | ||
<div class="trip-driver"> | ||
<h4>Driver</h4> | ||
<p><%= link_to trip.driver_id,trip_path(trip.driver_id), class: 'trip-link' %></p> |
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.
I would make the link have the driver's name with: trip.driver.name
instead of the driver's ID, as that doesn't tell the user as much information.
<%= link_to "Trips", trips_path %> | ||
</li> | ||
<li> | ||
<%= link_to "Add a trip", new_trip_path %> |
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.
Does this really go here? Shouldn't you only need to create a trip on the passenger's show page?
<h3>Trips: </h3> | ||
|
||
<% @trips.each do |trip| %> | ||
<section class="trips-table"> |
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.
The styling on this page is a little weird when the size of the screen gets smaller. The highlighted portion shrinks, but the text is still there if you scroll to the right.
border-radius: 5px; | ||
} | ||
|
||
@media all and (max-width: 500px) { |
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.
A media query, neat!
.driver-card, .passenger-card { | ||
display: grid; | ||
grid-gap: 10px; | ||
grid-template-columns: repeat(6, 220px); |
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 the grid of passengers and drivers rather fixed in size, maybe doing it with an auto number of columns would be more responsive.
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