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

Binu Alexander
Binu Alexander
4,081 Points

How to add 2 fields into migration from command line ?

How to add 2 columns in a single migration ?

rails generate migration AddDetailsToContacts first_name:string, last_name:string

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Removing the comma should do the trick.

Binu Alexander
Binu Alexander
4,081 Points

This is my code :rails generate migration AddDetailsToContacts first_name :string last_name :string

This is the error : The first argument should be the name of the table.

I removed the comma , still the error

Try putting in:

rails generate migration contacts first_name:string last_name:string

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Weird, it should assume contacts table by default from the name of the migration. Try:

rails generate migration add_details_to_contacts first_name:string last_name:string

Binu Alexander
Binu Alexander
4,081 Points

rails generate migration contacts first_name:string last_name:string

this is working