Time - Yaz#53
Conversation
…ilt in basic parameters in controller and validations in model.
…g controller#actions
…es tracked in model
…ation for work's categories by check against valid values. Also addded a retrieve category method for retrieving sub collections of works of certain categories. Written and passing corresponding tests.
…ow views for new and edit.
…dia. Changed controller works#index to hash structure pointing to three seperate category arrays
…th corresponding routes in routes.rb. Also deleted extraneous user#actions
…different table views of index and top_10
…ogin, user#current, and repurposed the old view users/new.html.erb to be login_form.html.erb
… login bug in controller
…conditions to work_controller, user_controller
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...?)
SummaryThanks for getting this in. This shows a good amount of growth and some solid progress in many areas, such as controller filters, and model methods. You do have several areas for improvement:
If you push any further commits and want me to review them, just ping me on Slack and I'll give it a 2nd look. |
| it "must get create" do | ||
| get votes_create_url | ||
| must_respond_with :success | ||
| end |
There was a problem hiding this comment.
Just noting that you need to do testing on VotesController
You'll need to:
- Login
- Find a work
- Upvote that work with the
work_votes_path
Then write tests verifying things happened right.
| @@ -0,0 +1,15 @@ | |||
| Rails.application.routes.draw do | |||
| get 'votes/create' | |||
There was a problem hiding this comment.
This route would need:
- more information, the work to upvote
- To be a post request
I would suggest you make this a nested route under works.
| # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html | ||
| root to: "works#top_10" | ||
| resources :works | ||
| get 'works/spotlight', to: 'works#spotlight', as: "spotlight" |
There was a problem hiding this comment.
Do you need a separate route for spotlight? That's part of the homepage.
| get "/current_user", to: "users#current", as: "current_user" | ||
| resources :users, only: [:index, :show] | ||
|
|
||
| post "/votes/create", to: "votes#create", as: "vote_create" |
There was a problem hiding this comment.
You seem to have this route duplicated.
| @@ -0,0 +1,4 @@ | |||
| <%= render partial: "single_work"%> | |||
| <%= button_to "Upvote", vote_create_path(@work) %> | |||
There was a problem hiding this comment.
If you look at routes.rb you don't have a route parameter for the work id.
| <th><%#votes%></th> | ||
| </tr> | ||
| <%end%> | ||
| <% @works[category].each do |work|%> |
There was a problem hiding this comment.
Just noting this would be a great view helper.
| @@ -0,0 +1,39 @@ | |||
| require "test_helper" | |||
|
|
|||
There was a problem hiding this comment.
Just noting these test don't work and are the autogenerated tests.
| # it "does a thing" do | ||
| # value(1+1).must_equal 2 | ||
| # end |
There was a problem hiding this comment.
Just noting no tests for WorksController.
| skip_before_action :require_login | ||
| before_action :find_work, only: [:show, :edit, :update, :destroy] |
| def self.retrieve_category(work_category) | ||
| if !@categories.include? work_category | ||
| raise ArgumentError.new("not a valid category") | ||
| end | ||
| return Work.where(category: work_category).to_a | ||
| end |
There was a problem hiding this comment.
Just noting that these are not sorted by votes.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? 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
sessionandflash? What is the difference between them?