Open
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
|
dHelmgren
reviewed
May 24, 2019
| 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.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.