Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgene c
13,630 Pointsrender template: "posts/index.html.erb", layout: "application"
I really don't understand what this is doing? what is render template and what does layout signify
1 Answer
Shaneil Clarke
4,630 PointsA template will be rendered automatically by rails that has the same name of the action.
render template: "posts/index.html.erb"
is specifying which template to render, in this example they loaded the same that would have been rendered anyways.
layout: "application"
is a default place you put HTML you want to be rendered on multiple pages. This prevents you from repeating the same HTML multiple places.