Conversation
…rors will appear on webpage
…d across all the way
… for select, and the second for html options. So all you need is to give default empty options as first param after list of items and then add your class to html_options. This fixed the category drop down to be the entire width of the container
…rails destroy controller
Media RankerWhat We're Looking For
|
| Rails.application.routes.draw do | ||
| root 'works#main' | ||
| resources :works | ||
| post 'works/:id/upvote', to: 'works#upvote', as: 'upvote' |
There was a problem hiding this comment.
The indentation doesn't actually mean anything here as it's not technically nested inside.
| resources :works | ||
| post 'works/:id/upvote', to: 'works#upvote', as: 'upvote' | ||
|
|
||
| resources :users |
There was a problem hiding this comment.
Do you need all the CRUD route for users? What about :edit and :update?
| vote = work.votes | ||
|
|
||
| # Assert | ||
| expect(vote).must_be_instance_of Vote |
There was a problem hiding this comment.
because vote here is actually a collection of votes, this test failed. If you wanted to test the type you could loop through the collection and check that each instance is a Vote.
Also since a Work has many votes, it doesn't have a foreign key in it.
Instead expect(vote.work_id).must_equal work.id
| end | ||
|
|
||
| describe 'Media Page - Methods' do | ||
| it 'return top 10 of a given category' do |
There was a problem hiding this comment.
You're not throughly testing all the methods here. Just top_movies for 10 items and more than 10 and top_books for less than 10. You don't test each.
| end | ||
| end | ||
|
|
||
| describe "Validations" do |
There was a problem hiding this comment.
No user validations?
What about tests for date_joined
| class User < ApplicationRecord | ||
| has_many :votes | ||
| has_many :works, through: :votes | ||
|
|
There was a problem hiding this comment.
No validations? What about username?
| def update | ||
| if @work && @work.update(work_params) | ||
| redirect_to work_path(@work.id) | ||
| elsif @book |
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <% @works.each do |work| %> |
There was a problem hiding this comment.
Notice that you do a very similar table here a lot. You could DRY this out with a partial.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?