-
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
Octos- Analisa & Ari- Rideshare- Rails #23
base: master
Are you sure you want to change the base?
Conversation
…rips taken in Show method
Updating working_with_drivers with master
Adding drivers to master
…d, trip_cost_dollars
…r driver trip_cost_dollars
|
||
def trip_cost_dollars | ||
if self.cost == nil | ||
return (self.cost = 0) |
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.
Why do this vs just returning 0?
<%= paginate @drivers, outer_window: 3 %> | ||
</div> | ||
|
||
<div class="driver_title"> |
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.
For CSS class names, we do not follow the Ruby naming conventions. For CSS this should be driver-title
not driver_title
.
@@ -0,0 +1,41 @@ | |||
<h2>Driver Details</h2> |
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 collection of data should be inside of one semantic HTML element to encapsulate it
|
||
<section> | ||
Passenger ID: | ||
<%= @passenger[:id] %><br> |
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.
You should not be using the hash-like syntax for retrieving attribute values, you should be using the built-in "dot methods". So this should be @passenger.id
instead.
<%= form_for @trip do |t| %> | ||
<%= t.label :date %> | ||
<%= t.date_field :date %> | ||
<% unless @trip.passenger_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.
Watch the indentation here - since you're using a conditional, the contents inside should be indented
<%= t.label :id %> | ||
<%= t.text_field :id %> | ||
<%= t.label :passenger %> | ||
<%= t.text_field :passenger_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.
This should be using the drop down that you utilize in the 'new' form
flash[:alert] = "Driver deleted" | ||
end | ||
|
||
def driver_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.
This should be under a private
section
def new | ||
if params[:passenger_id] | ||
passenger = Passenger.find_by(id: passenger_id) | ||
@trips = passenger.trips.new |
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.
Hmmmm... I'm curious why the new method in the passengers controller would need to instantiate a trip object.
def destroy | ||
@passenger = Passenger.find(params[:id]) | ||
@passenger.destroy | ||
redirect_to '/passengers' |
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.
You should use an _path
here instead of the string referencing the route
|
||
def new | ||
@trip = Trip.new(passenger_id: params[:passenger_id]) | ||
@trip.driver_id = Driver.get_random_driver |
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.
Yes - nice job having this method's logic in the model not here in the controller
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