-
Notifications
You must be signed in to change notification settings - Fork 42
Jackie - MediaRanker - Ampers #32
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
base: master
Are you sure you want to change the base?
Conversation
…rks_controller and view files
…o show list of works by category
…n testing to work model
…ages for invalid votes
Media RankerWhat We're Looking For
Looks good! The site looks and functions as expected. I think you hit all the major learning goals: advanced model & controller logic, styling, model testing. Overall, good work! |
| <section> | ||
| <%= form_for @work do |f| %> | ||
| <%= f.label :category %> | ||
| <%= f.select :category, ['album', 'book', 'movie'] %> |
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 hardcoded the list of categories here, but it might've been cool to find a rails form helper to populate a select with all unique categories that works have. ;) Just a thought.
| class Work < ApplicationRecord | ||
| validates :title, presence: true | ||
| validates_uniqueness_of :title, scope: :category | ||
| validates :category, presence: true, inclusion: { in: %w(book movie album), message: "%{value} is not a valid category" } |
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.
Looks great; but I wish %w(book movie album) were a constant!
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?