Angelica & Cara - Rideshare Rails - Octos#15
Conversation
We are working on different things, and are combining our two parts.
…llars in Passenger and Trips views.
Yes this is fine
Merging back to original after adding search bar for passengers
Changes to Trips search bar
Rideshare-RailsWhat We're Looking For
|
| get 'trips/index' | ||
|
|
||
| # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html | ||
| root 'home#index' |
There was a problem hiding this comment.
For readability, we put the root route at the top of the routes file.
| Rails.application.routes.draw do | ||
| get 'passengers/index' | ||
|
|
||
| get 'passenger/index' |
There was a problem hiding this comment.
Why would you have both this route and a plural version, neither of which follow the RESTFUL standard or get mapped to a controller action?
| <%= submit_tag "Search" %> | ||
| <% end %> | ||
|
|
||
| <section class = "add-link"> |
There was a problem hiding this comment.
When we use classes in our HTML, we do not use the same spacing conventions as we do in our Ruby code. We should not put spaces on either side of the equal, so: class="add-link"
| <%= link_to driver.name, driver_path(driver) %> | ||
| </strong> | ||
| </li> | ||
| </aside> |
There was a problem hiding this comment.
Watch your indentation here - its not right and makes the view code much harder to read than it needs to be.
| belongs_to :passenger | ||
|
|
||
|
|
||
| def convert_to_currency(n) |
There was a problem hiding this comment.
EEK! Watch indentation here - this is challenging to read
| Driver's Average Rating: <%= @driver.average_rating %> | ||
| </p> | ||
| <p> | ||
| Driver's Trips: |
There was a problem hiding this comment.
I'm not sure what happened with this section, but it ends up being really difficult to read. Recommend creating an overall semantic section of some sort of encapsulate all of this trip information. As well as possibly another HTML container that would contain the details of one piece of trip info.
| class DriversController < ApplicationController | ||
| def index | ||
| @drivers = Driver.all | ||
| if params[:search] |
There was a problem hiding this comment.
Nice job using the same route and pivoting on the params to determine which logic to execute
| @@ -0,0 +1,50 @@ | |||
| class PassengersController < ApplicationController | |||
| def index | |||
| @passengers = Passenger.all | |||
There was a problem hiding this comment.
By doing this first, you'll be doing an extra database query that you don't need. You only need the queries in the conditionals.
| @@ -0,0 +1,61 @@ | |||
| class TripsController < ApplicationController | |||
| def index | |||
| @trips = Trip.all.order(:id) | |||
| end | ||
|
|
||
| def create | ||
| passenger = Passenger.find_by(id: params[:passenger_id]) |
There was a problem hiding this comment.
This would potentially be good logic to move into the Trip object so that all of the defaults would be captured there instead
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