the application.html.erb is a file that is applied to all views in rails. In a way, its the master file, that all child files are styled / structured after.
How can I use this with Sinatra?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you want is called a “layout”; simply put a file named
layout.haml(orlayout.erb, or using the templating language of your choice) in your views directory and by default the contents of other views will be wrapped in it. Put the output ofyieldin the layout where the contents of individual views should go. For example:= yield<%= yield %>If you want the result of a route to use a different layout, you can specify the name of the alternative layout view like so:
If you want a particular route to not use any layout, pass
false:For more, see the Sinatra book.