Embedding other templates in Sinatra ERB templates

If you are using the Sinatra framework in Ruby, and you want to embed one ERB template in another, you can do this simply by using the ERB template tag like you can in your regular Ruby code.

<%= erb :welcome %>

Replace “welcome” with your template name as you usually do.

Timeline

Newsletter

Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.

Metadata

Tags: , , ,

This entry was posted on Sunday, November 4th, 2012 at 5:29 pm and is filed under Programming, Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.