Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics Migrations and Relationships Migrations 2

i think this is incorrect

wouldn't you want to say rails generate model, not rails generate migration if you are creating the Contact Model with last_name first_name? i.e.

rails generate model Contact last_name:string first_name:string

2 Answers

Andrew Kiernan
Andrew Kiernan
26,892 Points

Hi Nathan!

Normally you are right, if you want to generate a model and db migration at the same time, you would use rails generate model. However, in instances where you already have a model, you would generate a migration to add/remove/change columns and fields to the table.

The two challenges show the different ways you can add/change columns and fields through a migration, one in the migration file itself, and the other through the command-line generator.

I hope that made sense! Let me know if you have any other questions.


Hampton Catlin
Hampton Catlin
Treehouse Guest Teacher

Yeah, in Rails development, early on you use "generate model" a lot, but later on it's more about migrations to those existing models. So, trying to show both skills.