-
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
Space - Nikki Vaughan #36
base: master
Are you sure you want to change the base?
Conversation
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 job!
I liked how you organized your CSS into different files. It seems like you should go over controller filters another time and maybe look into how to use view partials to DRY up your code but overall you did well.
Your code was well organized and you have a good grasp of semantic HTML. 😃
def current_user | ||
@current_user = User.find_by(id: session[:user_id]) | ||
end | ||
|
||
def require_login | ||
if current_user.nil? | ||
flash[:warning] = "A Problem occured: You must log in to do that" | ||
redirect_back(fallback_location: "/") | ||
end | ||
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 would probably combine these into a single method:
def current_user | |
@current_user = User.find_by(id: session[:user_id]) | |
end | |
def require_login | |
if current_user.nil? | |
flash[:warning] = "A Problem occured: You must log in to do that" | |
redirect_back(fallback_location: "/") | |
end | |
end | |
def require_login | |
@current_user = User.find_by(id: session[:user_id]) | |
if @current_user.nil? | |
flash[:warning] = "A Problem occured: You must log in to do that" | |
redirect_back(fallback_location: "/") | |
end | |
end |
@work = Work.find_by(id: params[:id]) | ||
if @work.nil? | ||
head :not_found | ||
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 sort of repeated logic should be placed into a controller filter.
<% if flash[:details] %> | ||
<ul> | ||
<% flash[:details].each do |msg| %> | ||
<% msg %> |
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.
?
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...?)
|
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?