Hello World!

Learn to create custom controllers and views and how they interact with each other.

So far, we have laid the foundation for our application, but we have yet to touch on how to customize its elements. In the tradition of programming, you will do so by making your application display some variant of the phrase “Hello World!”.

Creating a custom controller

To do this, you need a controller and a view. As you may recall, a controller’s purpose is to receive requests for the application. A router decides which controller receives which request.

To create a new controller you need to run the controller generator script in the project root directory my_project/:

rails generate controller Hello index

Running this command will create a controller called “Hello” with an actionActions called “index”.

After the command has ...