Learn

Great! You created a new Rails app named MessengerApp.

Looking at this diagram of the request/response cycle, we need four parts to build a Rails app - a model, a route, a controller, and a view.

Let’s start here by creating a model.

Instructions

1.

In the terminal, generate a new model named Message

rails generate model Message
2.

Open the migration file in db/migrate/ for the messages table. The name of the migration file starts with the timestamp of when it was created. Inside the change method, add this line as line 4:

t.text :content
3.

Then in the terminal, run

bundle exec rake db:migrate
4.

Finally, run

bundle exec rake db:seed

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?