Add a navigation to the public area so that the public can move between different pages of the site. The navigation will be inside a partial file that is called and added to the public layout.
- [Narrator] In the last movie we created a public…controller and enabled it to display…pages from our CMS…but to view those pages we had to type their…names directly in the browser's URL bar.…Let's now create a navigation for the public area…by listing the available pages by their subject.…Each page is going to be a clickable link…then users can navigate our site and view…different pages just by clicking on the navigation links.…We're going to want our navigation to appear on…every single page inside the public controller.…And the navigation is going to want us to have…a list of all the subjects available so then…we can go through each subject and…get all of it's pages.…
So this is a perfect example of some housekeeping…that we can do with a before action.…Before_action :set up_navigation.…This will perform whatever we need to do to set…up the navigation so it's ready to use for all of the pages.…Private def set up_navigation.…Inside that method what do we want to do?…We want to find all of our subjects.…So subjects = subject…
- Creating and configuring a new Ruby on Rails project
- Generating controllers and views
- Handling server requests
- Using different types of routes
- Rendering and viewing templates
- Generating migrations and models
- Creating, updating, and deleting records
- Finding records with queries
- Understanding relationship types
- Writing controllers for CRUD
- Working with layouts and helpers
- Managing application assets
- Building forms
- Validating data
- Authenticating users
Skill Level Beginner
1. What Is Ruby on Rails?
2. Get Started
3. Controllers, Views, and Dynamic Content
4. Databases and Migrations
5. Models and ActiveRecord
7. CRUD, REST, and Resourceful Routes
8. Controllers and CRUD
9. Layouts, Partials, and View Helpers
12. Data Validation
13. Controller Features
14. User Authentication
15. Improve the Simple CMS
Next steps1m 44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.