This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- The Root Path 2:39
- Root Path 2 objectives
- Getting HTML from a Template 2:19
- Loading ERB Templates 1 objective
- Loading Text Files 2:43
- URL Parameters 4:19
- URL Parameters 1 objective
- ERB Tags 7:15
- ERB Tags 1 objective
- Embedding Page Data with ERB 4:22
- Embedding Instance Variables 3 objectives
- ERB 5 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
All the ingredients are in place. We have the page title from the URL parameter, and we're able to use the title to load the page contents. And we just learned how to embed data in an ERB template. Now we just have to get the title and content from the Sinatra route into the ERB template. The most common way to do that is by using instance variables. A Sinatra route shares a context with the Ruby code inside ERB templates. One major benefit is that code in an ERB template can access instance variables that you set in the Sinatra route.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Peter Buckwalter
6,846 Points2 Answers
-
Melissa Kerns
8,690 Points2 Answers
-
Min Jun Kim
1,281 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up