Adding Additional Pages

Adding static pages

Adding a static page with no dynamic content is simple. Its HTML file (e.g. "mypage.html") can be placed in the public folder. It can then be accessed or referenced by its file name with a leading slash (e.g. "/mypage.html").

Adding dynamic views to a controller

Adding a new page for dynamic content involves changes to the routing, controller and views. This example assumes you want to add a new view called "recent" to your movies controller:

You can view the list of routes (mapping between URL and controller action) with the command rake routes at the command prompt.

You can then link to this new page: <%= link_to 'List recent movies', recent_movies_path %>