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 trial

Ruby

Justin Banta
Justin Banta
3,834 Points

Nested Layouts in Ruby On Rails

I'm having trouble figuring out nested layouts for Ruby on Rails--it's not covered in any of the videos (as far as I can tell) and I can't quite parse the RailsGuide... (http://guides.rubyonrails.org/layouts_and_rendering.html). Basically, I want to build a landing page layout that doesn't include the normal navbar, etc.

2 Answers

Create a landing_page layout and specify it in your controller layout "landing_page". Use the landing page layout for your landing page and the application layout for the rest of your application.

Justin Banta
Justin Banta
3,834 Points

Thanks for your response! I should have been a bit more specific, I could create the layout and update the controller, but it wasn't loading on the landing page for some reason. But I just ended up creating a very basic application layout and using partials... not sure if that's best practice, but it's working. Thanks again.