Nested Routes Can Organize Content Pages

Learn about how nested routes can organize content pages of a Rails application.

We'll cover the following

Organized content looks good

In addition to the main features of our web app, websites that are accessible by the general public or a very wide audience often have noninteractive pages that serve up content. These could be pages like a privacy policy, a marketing landing page, or documentation.

Where possible, we should try to model these as resources, but doing so can often be awkward. For example, we could use resource :privacy_policy, only: [ :show ] to manage our privacy policy, using the singular resource, because we don’t have any privacy policies. Confusingly, Rails wants this served from the PrivacyPoliciesController. It’s even more difficult when we have landing pages for marketing that don’t map naturally to a resource at all.

Get hands-on with 1200+ tech skills courses.