Today I created a store application called depot:
What happens in the depot?
- Buyer can browse items, select items to purchase, supply info to make an order.
- Seller can keep inventory of items to sell, determine orders that are ready to ship and those which have already been shipped.
What do I do to prepare (after writing out user stories)?
- Draw out user flows.
- Draw out data diagram.
- Create the Rails project using the command,
rails new depot.
- Create the database migration, model, controller, views, and helper for products using the command,
rails generate scaffold Product title:string description:text image_url:string price:decimal.
Other stuff I learned:
- A migration represents a change we want to make to the database as a whole, or a change we want to make to the data. These updates can change both the schema and the actual data in the database.
- A magic command that will undo and redo our last migration is:
- If we change the schema in the code, we run
rails db:migrateand rails looks for all the migrations not yet applied and applies them.
- We want to be able to seed the data so that each programmer doesn’t have to manually enter their own data. Add data to file and then run
Today I created a Rails project, set up a development database and configured the application to be able to connect to it. I created a products controller and model and set up migrations to create the corresponding products table. Many views have been created as well.
Next step, get product listings tidied up.