Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.