Modern Front-End Development for Rails, Second Edition - incomplete definition (p16-17)

At the bottom of p16 you have a bullet point list of actions the setup script will take. One reads: “Run rails db:prepare—this creates the database”

On the next page, you write, “You should also run rails db:seed to get sample data in the database.” The command rails db:prepare takes care of the seeding step for you! In fact, it first checks to see if the database already exists. If not, it will create one before proceeding, if so, it skips that step and goes right to running the migrations and seeding the DB.

Thanks for the comment!

I think my text here could probably be less confusing, but what I think db:prepare does is create and seed the database if the database doesn’t exist, but just migrate the database if it does, which is why I think I was confused (because I was running the code against a database that already existed, so it wasn’t re-seeding).

I’ll clean it up before release.

Thanks,

Noel

Hi Noel,

That’s correct! I meant to add a link to this source code in my original post but forgot. It’s really ironic because I literally learned about rails db:prepare the same day I wrote that post!

I look forward to reading through the rest of your book.

Take care,
Meg