-
Notifications
You must be signed in to change notification settings - Fork 50
Daniela Sanchez - Leaves #28
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
base: master
Are you sure you want to change the base?
Conversation
…. It is passing all tests
Grocery StoreWhat We're Looking For
|
|
|
||
| def self.all | ||
| #CSV is an array of Hashes were each hash is a customer. | ||
| csv = CSV.read('/Users/dnsanche/ada/week3/grocery-store/data/customers.csv', headers: true).map(&:to_h) |
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 can't submit code that has the absolute path to github, because I don't have a folder called 'dnsanche'! Use the relative path moving forward.
| csv.each do |customer| | ||
| id = customer["id"].to_i | ||
| email = customer["email"] | ||
| address = { |
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 worth thinking about how you would do this if you couldn't add headers to the '.csv' file.
| class Order | ||
|
|
||
| attr_reader :id | ||
| attr_accessor :products, :customer, :fulfillment_status |
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.
Do you need attr_accessor for all of these?
Grocery Store
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError?.all&.findmethods class methods? Why not instance methods?OrderandCustomer. Is this relation one-to-one, one-to-many, or something else? How does that compare to the Solar System project?OrderandCustomertracked in the CSV file? How is it tracked in your program? Why might these be different?