-
Notifications
You must be signed in to change notification settings - Fork 43
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
Pipes - Sara Frandsen - Media Ranker (late) #47
base: master
Are you sure you want to change the base?
Conversation
Media RankerWhat We're Looking For
|
root 'works#main' | ||
|
||
resources :users, only: [:index, :show] | ||
resources :sessions |
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'm not sure if you need the full resources
for :sessions
here, especially since you've got login/logout listed explicitly below.
@@ -0,0 +1,9 @@ | |||
<%# partial view for top 10 lists %> | |||
<article> |
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.
Great use of a partial to DRY this up!
def upvote(work_id) | ||
work = Work.find(work_id) | ||
if Vote.where(work: work, user: self).count > 0 | ||
return false, 'Cannot upvote more than once!' |
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 like this as a model method! Good work!
def show | ||
# individual work | ||
@work = Work.find(params[:id]) | ||
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.
This would be a great bit of code to DRY up using a controller filter, especially if you extend the functionality to return 404 not_found
if that model instance doesn't exist.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?