-
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 - Rebecca - MediaRanker #21
base: master
Are you sure you want to change the base?
Conversation
…d in WorksController
Media RankerWhat We're Looking For
|
private | ||
|
||
def self.sort | ||
Work.all.sort_by {|work| -work.votes.count} |
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.
Good use of a private helper method here.
@@ -0,0 +1,86 @@ | |||
class WorksController < ApplicationController | |||
before_action :find_work_by_params_id, only: [:show, :edit, :update, :destroy] | |||
|
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.
Good use of filters to DRY up this controller
user1: | ||
username: username1 | ||
date_joined: 2017-10-11 | ||
|
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.
Pro tip: you can use erb inside a fixtures file. This could be shortened to something like
<% 20.times do |i| %>
user_<%= i %>:
username: username_<%= i %>
date_joined: 2017-10-<%= i %>
<% end %>
it "returns an empty array if category has no works" do | ||
top_albums = Work.top_ten("movie") | ||
top_albums.must_be :empty? | ||
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.
I love these three test cases! Good work!
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?