-
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
Branches - Diana Han #36
base: master
Are you sure you want to change the base?
Conversation
def self.find(id) | ||
customers = self.all | ||
|
||
result = customers.select {|customer| customer.id == 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.
You might want to look at Enumerable#find to simplify this a little.
attr_reader :id | ||
attr_accessor :products, :customer, :fulfillment_status | ||
|
||
STATUS = [:pending, :paid, :processing, :shipped, :complete] |
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.
Style: collections should have plural names.
STATUS = [:pending, :paid, :processing, :shipped, :complete] | |
STATUSES = [:pending, :paid, :processing, :shipped, :complete] |
if STATUS.include?(fulfillment_status) | ||
@fulfillment_status = fulfillment_status | ||
else | ||
raise ArgumentError |
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's helpful to include a message with the bad status:
raise ArgumentError | |
raise ArgumentError.new("Bad fulfillment status: #{fulfillment_status}") |
Well done! There were a few little things I pointed out but other than that everything looked good! |
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?