-
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
Angelica & Cara - Rideshare Rails - Octos #15
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
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.
Same comment re: extra DB query
end | ||
|
||
def create | ||
passenger = Passenger.find_by(id: params[: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 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