-
Notifications
You must be signed in to change notification settings - Fork 27
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
Branches - Kelsey and Brianna #11
base: master
Are you sure you want to change the base?
Conversation
…m Controller to Model
…, corrected active method
…input[type=submit])
…when that person is deleted
def convert_to_dollars(pennies) | ||
if pennies.nil? | ||
return 0 | ||
else | ||
(pennies / 100.0).round(2) |
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.
Love that y'all made a separate method for this! That said, the fact that this is repeated in three different classes is a sign that it probably belongs in its own class. It could be put in a class (maybe a new class called Money, for instance) and made a class method so that an instance of money isn't needed to call it.
validates :driver, presence: true | ||
validates :passenger, presence: true | ||
|
||
def self.all_in_alpha_order |
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.
Love this method!
@drivers = Driver.where(active: false) | ||
@selected_driver = @drivers[rand([email protected])] | ||
@trip.driver_id = @selected_driver.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 is a good candidate for a model method
# Assert | ||
expect(new_driver.valid?).must_equal false | ||
expect(new_driver.errors.messages).must_include :vin | ||
expect(new_driver.errors.messages[:vin]).must_equal ["can't be blank"] | ||
end | ||
end | ||
|
||
# Tests for methods you create should go here | ||
describe "custom methods" do |
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.
Great test coverage here!
Rideshare RailsWhat We're Looking ForGreat job y'all! Love the video link. Haha. Also love that all the driver and passenger names are links everywhere, making for easy navigation. I left some inline comments as well, so please do check those out. |
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
trip belongs_to :driver
,trip belongs_to :passenger
,driver has_many trips
,passenger has_many trips
. We set them up this way because it was intuitive and manageable.Driver (name, vin)
Passenger(name, phone_num)
,Trips(date, driver, passenger)
. They ensure that our methods cannot be executed without these parameters being fulfilled. All of our validations are set to have a presence oftrue