-
Notifications
You must be signed in to change notification settings - Fork 48
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
Leanne R #33
base: master
Are you sure you want to change the base?
Leanne R #33
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
session
andflash
? What is the difference between them?WHY DOES IT ALL WORK ON LOCALHOST BUT IS BROKEN IN HEROKU!?!