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
Start a free Courses trial
to watch this video
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 upRelated 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