Rails engine extending views, not overriding

Viewed 877

I am aware that I can override an applications view from within an engine by simply creating the same file within the engine and removing it from the application (eg: 'users/show.html.erb').

However, what I want is to be able to extend the applications view, not override.

Lets say I have a yield inside 'users/show.html.erb' of the main application:

yield :foo

What I want is for the engine to specify the same file 'users/show.html.erb' and to have a content_for block

content_for :foo {}

Thereby, injecting some template data from the engines view, into the applications view.

Obviously, the above won't work as once it has found the template file in the application, it won't look for one in the engine.

Is there a way to make this work?

1 Answers
Related