Embedding Page Data with ERB4:22 with Jay McGavren
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.
You need to sign up for Treehouse in order to download course files.Sign up