Linking Page Together

Let’s get familiar with Rails views and link them with controllers.

It’s a rare web application that has just one page. Let’s see how we can add another stunning example of web design to our “Hello, World!” application.

Normally, each page in our application will correspond to a separate view. While we’ll also use a new action method to handle the new page, we’ll use the same controller for both actions. This isn’t compulsory, but we have no strong reason to use a new controller right now.

We already defined a goodbye action for this controller, so all that remains is to update the scaffolding that was generated in the app/views/say directory. This time, the file we’ll be updating is called goodbye.html.erb because templates are named after their associated actions by default:

Get hands-on with 1400+ tech skills courses.