Saving Data
Learn how to add a database to a Rails app.
StartSaving Data
Lesson 1 of 1
- 1So 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…
- 2Great! You created a new Rails app named MessengerApp. Looking at this diagram of the request/response cycle, we need four par…
- 3What did we just do? 1. The rails generate model 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 represent…
- 5Nice 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…
- 6Nicely 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 …
- 7Congratulations! 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
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory