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 trialDavid Ker
14,439 PointsMigrations 2 code challenge - can't get it to accept an answer
Having issues with the Migrations 2 code challenge...I've tried
rails generate migration CreateContacts first_name:string last_name:string
, and variations on it, but it keeps saying "The first argument should be the name of the table"...even though it is, through CreateContacts
...which matches the default migration in the Migrations 1 code challenge.
Anyone have any hints??
4 Answers
Salman Akram
Courses Plus Student 40,065 PointsHi David,
I found errors that you use this variable called "CreateContacts" from the Migration Challenge 1 but Challenge 2, you will find new variable called "contacts"
Question: In the last question, we created a table called contacts, with a first_name and last_name string. How could you include both of those fields automatically by using the generator command?
Answers: Just remove CreateContacts, you should use just "contacts"
rails generate migration contacts first_name:string last_name:string
José Alves
Front End Web Development Techdegree Student 5,657 PointsThis makes no sense but ok.. thanks you!
David Ker
14,439 PointsThat did it, thanks! I thought I had tried using contacts
before. Oh well...thanks again!!
Sarah A. Morrigan
14,329 PointsI still get error on
rails generate migration contacts first_name:string last_name:string
rake db:migrate
"Bummer! The fields should be specified with a colon separating the name and the type."
name:type is there.
I am right, and the Code Challenge is wrong.
Sarah A. Morrigan
14,329 Pointsnevermind... i did not have to put rake db:migrate
sunless
8,937 Pointssunless
8,937 PointsBut this is actually wrong. If you do so, rails will generate a migration named
datestamp_contact
with
in it. Which is certainly not what you want.
Instead using:
rails generate migration AddXXXToContact first_Name:string last_name:string
will generate
You might want to fix the challenge accordingly...