-
Notifications
You must be signed in to change notification settings - Fork 47
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
Time - Yesenia #45
base: master
Are you sure you want to change the base?
Time - Yesenia #45
Conversation
Media RankerFunctional Requirements: Manual Testing
Major Learning Goals/Code Review
Previous Rails learning, Building Complex Model Logic, DRYing up Rails Code
Testing Rails Apps
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
SummaryNicely done, you hit all the learning goals here. You don't have controller tests, but otherwise this is outstanding. Take a look at my comments and let me know what questions you have. |
@@ -0,0 +1,15 @@ | |||
Rails.application.routes.draw do |
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.
Very nicely done here
@@ -0,0 +1,7 @@ | |||
require "test_helper" | |||
|
|||
describe UsersController do |
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.
Just noting no tests here
@@ -0,0 +1,7 @@ | |||
require "test_helper" | |||
|
|||
describe WorksController do |
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.
Just noting no tests here
|
||
has_many :votes, dependent: :destroy | ||
|
||
def self.sort_works(category) |
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.
Suggestion, make the valid categories a constant array and then you can check to see if the category is valid with CATEGORIES.include? category
Then you can use the variable with self.where(category: category)
|
||
def show | ||
if @work.nil? | ||
render_not_found |
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!
return | ||
else | ||
flash.now[:error] = "A problem occured: Could not create #{@work.category}" | ||
render :new |
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.
render :new | |
render :new, status: :bad_request |
return | ||
else | ||
flash.now[:error] = "A problem occured: Could not update #{@work.category}" | ||
render :edit |
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.
render :edit | |
render :edit, status: :bad_request |
# create instance variable to pass the vote errors to the views | ||
@invalid_vote_message = @vote.errors.messages | ||
|
||
render :show |
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.
render :show | |
render :show, status: :bad_request |
<% if books.instance_of? String %> | ||
<p><%= books %></p> | ||
<% else %> | ||
<ul class="list-group top-ten__list"> |
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 part can be done with a partial view.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?Assignment Submission: Media Ranker
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
session
andflash
? What is the difference between them?