Table of Content
Lab – Adding category
Try to allow assigning one and only one category to each job.
steps:
- category model
- category controller
- form for category
- associate with job
- set category in job
selecting the category as a list instead of inputing the number.
f.collection_select :category_id, Category.all, :id, :title, prompt: 'Choose a category'
Full source code can be found in the course github project: makzan/ruby-on-rails-course-2013.
What’s next? We’re going to take a look at “Uploading files”.