Models 2 First step

I’m not sure if this was ever covered at all in the Ruby course, but I’m not sure what they are asking for when they say to add the columns. Is there an example of what a column is supposed to look like or what the syntax is?

a string column called title
a string column called image

In the Codecademy Python lesson 13.) Battleship I think is a great example of using columns (and rows). Did you complete that lesson?

1 Like

Haha wow I guess I completely forgot that this was a Ruby based system for a second. I just finished the Python course so I think I got a little mixed up. Would this be similar to what I did in the battleship lesson? or is there something within the Ruby lessons that I should go back over and review that covers this?

I have not taken Ruby so that will be a question for another person. I would assume its different. However, having experience with rows or columns in other languages I am sure cannot hurt and might even help

Alright I managed to figure it out. syntax is “t.string :something” under the line create_table line.


@ohspoons It’s talking about database columns, and an easy way to visualize a database is to think of a spreadsheet:

You can see there we have a table (all of the columns and rows), which will store data about something, for example it might have an “Article” table for a blog. Then, we have columns. Each column stores a specific piece of data, such as the title for a blog entry or the text for the blog post itself. And then there are rows. Every row stores a new entry, which might be a new blog post, and it will store it’s title in the title column of the row and it’s text in the text column.

If we then wanted to have author pages as well, we would create a new table (“Sheet1”, “Sheet2”, “Sheet3” at the bottom would be tables) called Author and have columns in it for name, bio, and whatever else we wanted to store.

I hope this helps you understand it a little better :slight_smile:

1 Like

This does help me visualize whats happening, thank you!

1 Like

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