-
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
Kate N - Sockets #51
base: master
Are you sure you want to change the base?
Kate N - Sockets #51
Conversation
Media RankerWhat We're Looking For
|
@@ -0,0 +1,9 @@ | |||
Rails.application.routes.draw do | |||
resources :works | |||
resources :users, only: %i[index 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.
Good work only generating the routes you need for users
.
def create | ||
@work = Work.new(work_params) | ||
@work.save | ||
redirect_to work_path(@work.id) |
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.
What happens if the work fails to save?
|
||
def edit | ||
@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.
What if the user typed a bad ID into the URL bar?
<h3>MOVIES</h3> | ||
<ul> | ||
<% @movies.each do |movie| %> | ||
<li> <%= link_to "#{movie.title}", work_path(movie.id) %> </li> |
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 have the same code to show a list of works repeated 3 times. Could you use a view partial or a loop to DRY this up?
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?