The following questions will require you to run some basic rails commands in the command line.
You will have to realize by yourself what commands to run.
- Create a new rails app called "my-store"
- Create a "Product" scaffold with the following fields: - Name (text) - Price (integer) - Quantity (integer) - Category (select)
- Run a migration to create the tables for your database
- Run your app and create some Products.
- Add the following validations to the Product model: - Name should be unique - Price can only be a positive number - Quanitity can't be bigger then 5
- Create the "Category" scaffold with the following fields: - Name (text)
- Run a migration to create the tables for your database
- Create the rigth association between the Products model and the Category model with the followin rules: - A Category can have many Products - A Product belongs to only one Category
- Run your app and create some Categories.
- Change your routes.rb file to make the root target the Products page.