-
Notifications
You must be signed in to change notification settings - Fork 25
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
Leti & Maddie - VideoStoreAPI - Ampers #21
base: master
Are you sure you want to change the base?
Conversation
…to rental-model
…to ms_feature-rentals-controller
…passing on smoke test, but there is still 2 failing
…customer controller
… attribute instead of calling the assign_due_date_method.
…to ms_feature-sort
has_many :rentals | ||
|
||
def available_inventory | ||
if self.inventory |
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.
Why would self.inventory
ever not be true?
Video StoreWhat We're Looking For
f--F-F-FAAANCY pagination work!!! Also rabl working, nice! I think that the project looks good -- I think the model and controller tests are pretty thorough In your fixtures files, like Otherwise, looks good -- I think there are some really nice stylistic things that you all did that I'll comment on! |
end | ||
|
||
else | ||
render json: {ok: false, errors: "This will not work"}, status: :bad_request |
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.
The phrase "This will not work" is a little awkward sounding?
class MoviesController < ApplicationController | ||
def index | ||
|
||
params[:sort] ? (sort = params[:sort].to_sym) : sort = :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.
this line is great! I'm a fan!
Ternaries also work so you can assign things like this (this does the same thing you did):
sort = params[:sort] ? params[:sort].to_sym : :id
|
||
@movie = Movie.find_by(id: params[:id]) | ||
|
||
render json: {ok: false, error: :not_found}, status: :not_found if @movie.nil? |
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.
these post-fix conditionals look really fancy and nice!
# scope :by_name, -> (name) { where(name: name) } | ||
|
||
def movies_checked_out_count | ||
return Rental.where(customer_id: self.id).where(returned: false).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.
This might be an instance where instead of Rental.where(customer_id: self.id)
you could use self.rentals
, if you find a way to filter on these with returned == false
(maybe .filter
?)
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.
Then again, I see the benefit in the style you wrote it in already here
font-size: 30px; | ||
} | ||
|
||
.about-me { |
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.
What are these styles from? :P
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