Brandy Austin - Media Ranker - Octos#20
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.
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.
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.
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.
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.
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.
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.
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?