The primary template can render other templates. These are called partial templates because they include only a fragment of a template. Partial templates are an important tool for keeping code organized and for helping create reusable portions of code.
- [Instructor] The templates that we've been rendering…so far have been complete templates.…Now, I want us to learn how we can organize…our code better by making use of partial templates.…The way that we use a partial template is just simply…in one of our existing templates to render another template.…And we do that by just calling erb again.…So we can nest this inside our template.…So we have an erb tag in our route,…that's telling it to get started with the process,…to start rendering this file, and then…throughout the file, we can also have…more calls to erb, to render other templates.…
So, in this example here, you can see that…inside the HTML we have some erb tags,…and inside there we're calling erb,…and we're providing another template name,…a template called navigation.…Notice that I have the equal sign in front of that.…It's important that we want to output this,…we don't want to just have erb…go process this, and come up with a string,…and then not do anything with it,…we need to have that equal sign at the beginning.…
- Installing Sinatra
- Launching the server
- Defining routes
- Using route patterns and parameters
- Redirecting requests
- Rendering dynamic templates
- Using partial templates and layouts
- Defining custom helpers
Skill Level Intermediate
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
Ruby on Rails: Get More From ActiveRecordwith Kevin Skoglund4h 27m Intermediate
3. Helpers and Filters
4. Useful Techniques
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.