Saving Data

Learn how to add a database to a Rails app.

Start[missing "en.views.course_landing_page.learn-rails.course_illustration" translation]
Saving Data
Lesson 1 of 1
  1. 1

    So far we've built a Rails app containing a static page. To do this, we used a controller, a route, and a view. The request/response cycle summarizes how these three parts work together. However...

  2. 2

    Great! You created a new Rails app named MessengerApp. Looking at 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 ...

  3. 3

    What did we just do? 1. The [...] command created a new model named Message. In doing so, Rails created two files: 1. a model file in app/models/message.rb. The model represents a table in ...

  4. 4

    Nice work. We added a controller and a route to the Rails app. Why does the Messages controller use an action named [...] ? Check out the diagram in the browser. Rails provides seven standard con...

  5. 5

    Nice work! The app now displays a list of all messages in the database. How does this work? The file index.html.erb is a web template. Web templates are HTML files that contain variables an...

  6. 6

    Nicely done! The app now takes in messages through a form and saves them into the database. How does this work? Let's use the request/response cycle as a guide to trace how a user's request flows ...

  7. 7

    Congratulations! You built a messaging app that uses a database to store messages. What can we generalize so far? A model represents a table in the database. A migration is a way to update...

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

Saving Data

Start[missing "en.views.course_landing_page.learn-rails.course_illustration" translation]