Open
Conversation
Media RankerWhat We're Looking For
|
| </section> | ||
| </main> | ||
|
|
||
| <%= yield %> |
There was a problem hiding this comment.
This yield should probably be inside your <main> section
|
|
||
| <p>Top Books</p> | ||
| <ul> | ||
| <% @books.each do |work| %> |
There was a problem hiding this comment.
Each of these media types could probably be its own <section>
| def show | ||
| @work = Work.find_by(id: params[:id]) | ||
| unless @work | ||
| head :not_found |
There was a problem hiding this comment.
You might DRY this code up using a controller filter.
| @works = works.sort_by {|work| -work.votes.count} | ||
| movies = Work.where(category: "movie") | ||
| @movies = movies.sort_by {|work| -work.votes.count} | ||
| books = Work.where(category: "book") |
There was a problem hiding this comment.
This is definitely all functionality that ought to be in the model, but I still like it better here than if you had done it in the view.
| must_redirect_to root_path | ||
|
|
||
| User.count.must_equal start_user_count + 1 | ||
| end |
There was a problem hiding this comment.
It might also be interesting to test logging in an existing user.
| work_id = Work.first.id | ||
| delete work_path(work_id) | ||
| must_respond_with :redirect | ||
| end |
There was a problem hiding this comment.
What happens if you attempt to destroy a work that has votes? Can you do it? What happens to those votes?
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.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?