-
Notifications
You must be signed in to change notification settings - Fork 26
Erica & Angela #8
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
Added Customer.rb Model Tests -relationships and a sample validation
Rental model custom method and tests
added available inventory and movies checked out count
…checked out movies
… and corresponding test
Video StoreWhat We're Looking For
|
| def index | ||
| customers = Customer.all | ||
| # render json: { ok: true, customer: customers.as_json(only: [:id, :name, :register_at, :postal_code, :phone]) }, | ||
| render json: customers.as_json(only: [:id, :name, :phone, :postal_code, :registered_at], methods: [:movies_checked_out_count]), |
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.
Small style note: not all text editors wrap lines for you. This line is so long that on GitHub I have to scroll horizontally to see all the pieces. You can make this easier to read by putting a newline after any given comma in a statement.
|
|
||
| validates :name, presence: true | ||
|
|
||
| def movies_checked_out_count |
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 love that you made Customer#movies_checked_out_count and Movie#available_inventory methods instead of storing them in the database. That way there's no way to forget to update these values.
Video Store API
Congratulations! You're submitting your assignment!
If you didn't get to the functionality the question is asking about, reply with what you would have done if you had completed it.
Comprehension Questions
POST /rentals/check-inendpoint? What does the time complexity depend on? Explain your reasoning.