Help on 3.1


#1

I can't figure out how to make new columns such as title and image.


#2

Hi @aaaaaaaaaf,

  1. What can you not figure out? What file to modify, what to type in that file, how to migrate the database, what?
  2. Please post a link to the exercise you're stuck on so we can look at the exercise ourselves :slight_smile:

#3

@zystvan, here is the link : [https://www.codecademy.com/courses/learn-rails/lessons/one-many/exercises/one-many-models-ii]


#4

It will also probably help @zystvan out if you post your code and the error that your code brought up so he can help you faster and give you a better response.


#5

@aaaaaaaaaf @bibleman13 is correct, I still need to know what you don't understand in the exercise :slight_smile:


#6

Hello !

I have the exact same difficulties :slight_smile:

here is the exercise text :

"Now that there's an association between Tag and Destination, let's continue and add columns to the migration files.
Open the migration file in db/migrate/ for the tags table, and add the following columns:
a string column called title a string column called image "

Here is my code :

The exercise ask us to create new column of "string" type.. and i don't remember what to do


#7

@gzorax The create_table part creates a database table, and t is an iterator that lets you create a column. So, the syntax to create a column that stores a string would be:

t.string :column_name

If you wanted to store a title for something, that look like this:

t.string :title

#8

Thanks that's perfect :slight_smile:


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.