Create Model Class and Migrate Database

❮❮ ❮ Back
Next ❯ ❯❯

Task

Steps

Pre-Task Steps

Inspect model files and folders:

Inspect database tables:

psql --command="\dt" app_development

Task Steps

Generate model class Person and database migration script:

rails generate model Person first_name:string last_name:string height_inches:integer weight_lbs:integer

Run migration to configure database:

rails db:migrate:reset

Post-Task Steps

Inspect the database tables:

psql --command="\dt" app_development

Inspect schema of people table:

psql --command="\d people" app_development

Inspect rows of people table:

psql --command="SELECT * FROM people" app_development

Inspect generated migration:

Inspect generated model class:


❮❮ ❮ Back
Next ❯ ❯❯