Status: In Beta!

See something that looks weird or doesn't make sense? Let us know!

Welcome to Lab 4! So far in the course, we've discussed routes, controllers, views, and β€”new today β€” models. Brief recap: What are models? They are a way we can structure data that our app needs to interact with. What are databases? They are a very organized way to save our data outside of the program files itself, and everything is represented in simple tables. Columns represent the attributes of a model, and rows represent a record or an instance of that model.

Students Table

Here's an example of what we're looking at! A table to represent student objects. All students have a first_name, a last_name and an age. As we create more students, we can just add more rows to the table! Let's dive into an example of how this will look in a Rails application.

In-Class, if we have time for the lab, we'll be working collaboratively! Pair up, remix this glitch project, and invite your partner to join it. You only need one between the two of you.

Glitch URL: https://glitch.com/edit/#!/rails-lec-4-lab

If you're working at home: run whales new models_lab rails-decal/lec-4-lab to get started.

The Next Amazon

In today's lab, we're going to build Jeff Bezos' worst nightmare: a competitor to Amazon. We'll provide you the base skeleton with routes, controllers, and some basic views. You'll be adding the functionality to help the app come alive. Instead of dealing with creating accounts and logging in and such, we're simply going to create a sort of admin dashboard where you can create sellers, create buyers, create products, and orchestrate purchases.

There's a lot of moving parts here, and it seems like a ton of functionality (it is!). But for one: this lab is here to guide you through it so that you can see how all these parts work. And two: as you'll soon be familiar with, Rails makes this process pretty painless! Finally, it'll hopefully be a little easier to get through these tasks when the UI is already built out for you 😊

Task 1: Brainstorming a schema and generating our models