February 2019
Intermediate to advanced
240 pages
5h 25m
English
In this chapter, we learned how to set up and configure a database for our Rails app—something the vast majority of Rails apps typically need.
Let’s review what we covered:
We started up a Postgres server in a container using Compose.
We verified that the Postgres server was running by connecting with the Postgres client from a separate container.
We configured our Rails app to talk to Postgres by installing the Postgres gem, modifying our database.yml file, and running the Rake task to create the databases.
We put our new database through its paces by generating a scaffold, running migrations, and inserting, deleting, and updating records.
We discussed why it’s a good idea to decouple our database container from data we want to persist. ...