-
Notifications
You must be signed in to change notification settings - Fork 50
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
Leaves - Mariya #44
base: master
Are you sure you want to change the base?
Leaves - Mariya #44
Conversation
|
||
def self.find_by_customer(customer_id) | ||
customer_orders = [] | ||
Order.all.each do |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.
This looks good! In case you want something shorter that does exactly what you implemented, you might want to check out: https://ruby-doc.org/core-2.6.1/Enumerable.html#method-i-find
|
||
|
||
it "Returns nil for an order that doesn't exist" do | ||
no_order = Order.find(101) |
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.
It might be nice to give a name to the value 101
, like non_extant_order_id = 101
Grocery StoreWhat We're Looking For
|
Grocery Store
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError
?.all
&.find
methods class methods? Why not instance methods?Order
andCustomer
. Is this relation one-to-one, one-to-many, or something else? How does that compare to the Solar System project?Order
andCustomer
tracked in the CSV file? How is it tracked in your program? Why might these be different?