Hello Rails

Get familiar with Rails actions and controllers in this lesson

We can’t help it. We just have to write a “Hello, World!” program to try a new system. Let’s start by creating a simple application that sends our cheery greeting to a browser. After we get that working, we’ll embellish it with the current time and links.

As we explore further in the The Architecture of Rails Applications chapter, Rails is a model-view-controller (MVC) framework. Rails accepts incoming requests from a browser, decodes the request to find a controller, and calls an action method in that controller. The controller then invokes a particular view to display the results to the user. The good news is that Rails takes care of most of the internal plumbing that links all these actions. To write our “Hello, World!” application, we need code for a controller, a view, and a route to connect the two. We don’t need code for a model because we’re not dealing with any data. Let’s start with the controller.

Get hands-on with 1200+ tech skills courses.