-
Notifications
You must be signed in to change notification settings - Fork 42
Brandy Austin - Media Ranker - Octos #20
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
Media RankerWhat We're Looking For
|
|
|
||
| validates :category, presence: { message: "You must choose a category" } | ||
|
|
||
| validates :title, presence: { message: "Title can't be blank" } |
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 about validations for publication year?
| end | ||
|
|
||
| def self.top_movies | ||
| where(category: "movie").sort_by{ |m| m.votes.count }.reverse.first(10) |
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 methods could be DRYed up slightly by creating a generic method with a parameter.
| <%= csrf_meta_tags %> | ||
| </head> | ||
|
|
||
| <header class="page-header"> |
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've put this element outside the body. That's not valid HTML.
| @all_movies = Work.all_movies | ||
| end | ||
|
|
||
| it 'returns all movies' do |
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 should also test the result when there are no movies.
|
|
||
| describe 'media spotlight' do | ||
|
|
||
| it 'returns top work' do |
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 about when there are either no votes or no works?
|
|
||
| end | ||
|
|
||
| describe 'top moves, books, albums' do |
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 also need to see what happens when there are more than 10 works in a category and when there are no works in a category.
| validates :title, presence: { message: "Title can't be blank" } | ||
|
|
||
| def self.all_movies | ||
| where(category: "movie") |
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 should include something to order the content as well.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?