Paritosh Singh
Paritosh Singh

Reputation: 6404

Rails engine: render parent application layout

Here I want to render the layout of engine's parent application, i.e. in hierarchy engine's parent application.html.erb should be higher. But since engine has also got application.html.erb it is only rendering it and not rendering engine's parent application.html.erb.

How can i render my parent application.html.erb along with my engine application.html.erb

Thanks

Upvotes: 8

Views: 3421

Answers (1)

Romeo Mihalcea
Romeo Mihalcea

Reputation: 10262

In your engine controller you can use:

layout 'application'

in order to render the application layout or you can switch to:

layout 'engine_name/application'

to load the engine's layout.

I don't know if you can load them both (engine layout should only inherit from application layout and extend it) but I hope it gets you further at least.

Upvotes: 14

Related Questions