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, a Rails app with static pages looks the same for all users. How can we create apps that save information? We do this with a database. Here’s how a database fits into the request-response cycle. Check out the diagram in the browser.
http://localhost:8000/welcome, the browser makes a request for the URL
Let’s see how to incorporate a database by building a Rails app for a messaging service.
Create a new Rails app named
MessengerApp using the
rails new command.
Install the gems in Gemfile.
Run the local server with the command,
rails s to view the app at