Adding a "marketing site" to Rails 5

Let’s say you’re building a Rails 5 app and you want to add a “marketing site” to the public-facing side of your app. In my opinion, the cleanest way to do this is to create a public-facing PagesController with methods for each page:

rails g controller Pages home about help contact

Then, set up your routes:

# routes.rb
root to: "pages#home"

get '/about' => 'pages#about'
get '/help' => 'pages#help'
get '/contact' => 'pages#contact'

And finally, create app/views/pages/home.html.erb, app/views/pages/about.html.erb, and so on.

I'm Mark Thomas Miller, an engineer, designer, and maker of things.