Continue from previous article, let's add one more route /about/company
. You know the steps now to make this route working in Rails application.
First, add a route entry like this.
Rails.application.routes.draw do get "/about" => "about#index" get "/about/company" => "about#company" end
Second, we already have the AboutController
. So, we just now need to add company
method.
class AboutController < ApplicationController def index end def company end end
Finally, we already have about
folder. So, we just need to create company.html.erb
with following code inside this file.
<h1>About company</h1>
Visiting the /about/company
should display this About company
header in the browser.
Labels: rails