Nested layouts and Engines

I have a main application, does some basic ‘core’ functions and then everything else is a mountable engine.
What I would like to do is to enclose the engine layout in the application layout. Each engine might have a different layout but I have a base ‘frame’ for the entire application.

Something like this
application_layout (yields entire layout)
–> engine_layout (yields engine layout with current_action html)
– –> current_action_view (yields current action html)

I looked at nested layouts on the rails guides site and this seems like it’s the answer but it’s not working as expected.

Anyone know if what I’m wanting to do is possible?

Rails only allows one layout and a view to work out of the box with one yield block. So I believe an engines layout file will disregard the application layout.
If you want to nest you need to use content_for blocks and custom template render calls to do what you want.

Does that help you?

Yeah, thanks.

I don’t agree with calling this ‘nested layouts’ as it’s not using layouts inside of layouts, it’s just using content blocks…*doesn’t seem the same.

You can explicitly call render ‘template.blah’ to nest views, you are right that overriding content_for blocks is just switching out parts of the layout.