Space - Stephanie#49
Conversation
Users login and log out functional - controller tests not passing
current user page made
Votes & Users functional
Model testing
Top ten & spotlight completed
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
Additional FeedbackIt feels to me like the tail end of this assignment was rushed. I see a lot of really solid foundational work, but the newer concepts didn't make it in to the project. I really want to highlight testing in all of this, because if you had tested this project fully, that on its own would have made the difference between a green and a red assignment. Message me about this project if you want to talk through my feedback! This is one assignment. Don't let this stumbling block bring you down! |
| Rails.application.routes.draw do | ||
| root to: 'homepages#index' | ||
|
|
||
| resources :works |
There was a problem hiding this comment.
Weird that your edit page for works isn't working. I'm going to take a peek at that page too!
| <section class="top-ten__container"> | ||
| <section class="top-ten__list-container"> | ||
| <h2 class="top-ten__header">Top Movies</h2> | ||
| <ul class="list-group top-ten__list"> | ||
| <%@top_ten_movie.each do |movie|%> | ||
| <li class="list-group-item"> | ||
| <h4><%=link_to movie.title, work_path(movie.id)%> | ||
| <small class="top-ten__creator"> by: <%=movie.creator%></small> | ||
| </h4> | ||
| <p><%=movie.votes.count%> votes</p> | ||
| </li> | ||
| <%end%> | ||
| </ul> | ||
| </section> | ||
| <section class="top-ten__list-container"> | ||
| <h2 class="top-ten__header">Top Books</h2> | ||
| <ul class="list-group top-ten__list"> | ||
| <%@top_ten_book.each do |book|%> | ||
| <li class="list-group-item"> | ||
| <h4><%=link_to book.title, work_path(book.id)%> | ||
| <small class="top-ten__creator">by: <%=book.creator%></small> | ||
| </h4> | ||
| <p><%=book.votes.count%> votes</p> | ||
| </li> |
There was a problem hiding this comment.
This is a great place to use a view partial, as you have the same html repeated 3 times!!!
| <span><%= button_to "Back to media ranks", root_path, :class => "btn btn-primary", form: {style: 'display:inline-block;'}%></span> | ||
| <span><%= button_to "Edit", edit_work_path, :class => "btn btn-primary", form: {style: 'display:inline-block;'}%></span> |
There was a problem hiding this comment.
I think both of these buttons are trying to use the post verb, which is breaking the routes!
| work_id = params[:id] | ||
| @work = Work.find_by(id: work_id) | ||
| if @work.nil? | ||
| head :not_found | ||
| return | ||
| end | ||
| end | ||
|
|
||
| def edit | ||
| @work = Work.find_by(id: params[:id]) | ||
|
|
||
| if @work.nil? |
There was a problem hiding this comment.
You have a few methods that require a specific work to be fetched, making this a good place to use controller filters.
| flash[:message] = "You have already voted for this work" | ||
| redirect_back(fallback_location: root_path) | ||
| return | ||
| elsif session[:user_id] |
There was a problem hiding this comment.
This doesn't need to be an elsif, as you know after the initial if that we at least have a user.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?Assignment Submission: Media Ranker