Conversation
…nly logged in user
Media RankerWhat We're Looking For
|
| # get 'works/new' | ||
|
|
||
| resources :works | ||
| resources :users |
There was a problem hiding this comment.
I don't think you need all 7 restful routes for users - only index and show are needed for this project.
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <% @works.each do |work| %> |
There was a problem hiding this comment.
Unfortunately, this doesn't account for categories.
| </h2> | ||
| <ul class="list-group top-ten__list"> | ||
| <% @top_works.each do |work| %> | ||
| <% if work.category == category.name %> |
There was a problem hiding this comment.
This might well work, but your works don't get created with categories, and it is impossible to create new works with categories.
| @@ -0,0 +1,18 @@ | |||
| class Vote < ApplicationRecord | |||
| belongs_to :user | |||
| belongs_to :work | |||
There was a problem hiding this comment.
You can't delete a work that has votes! This is because you've created a link between the two tables at the database level, and deleting the work would leave behind invalid votes. You might want to check out the dependent argument to has_many.
| expect(valid).must_equal false | ||
| expect(other_work.errors.messages).must_include :title | ||
| end | ||
|
|
There was a problem hiding this comment.
There's a lot of interesting test cases for your custom Work methods missing here. For top_work, I would wonder:
- What happens if there are no works?
- What happens if there are works but no votes?
- What happens if two works have the same number of votes?
Similarly for your category and top ten methods, I would ask:
- What if there are no works of that category?
- What if there are less than 10 works?
- What if there's a tie for last place, e.g. works 9, 10 and 11 all have 0 votes?
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?WHY DOES IT ALL WORK ON LOCALHOST BUT IS BROKEN IN HEROKU!?!