In one hand, I have a mountable engine let's say Front Front contain my assets and couple of pages It's isolated from MainApp. I don't want it to touch the main app.
In the other hand I want my MainApp using layout and partial of the Front. So I setup the layout this way :
class ApplicationController < ActionController::Base
layout 'front/application'
end
But the front/application refer to engine partial directly, because of isolation, like this
render 'header' # front/ prefix is not required
So the MainApp views try to load app/views/application/header instead of app/views/front/application/header
To fixe this I put a prepend_view_path like this :
class ApplicationController < ActionController::Base
layout 'front/application'
before_filter :prepend_front
protected
def prepend_front
prepend_view_path "app/views/front"
end
end
But this doesn't work because engine path point into the vendor. The engine add it self this to the prepend path list : ~/main_app/vendor/private_gems/front-0.0.2/app/views And my preprend_front method create this : ~/main_app/app/views/front
I tryed to prepend by force the correct path (but it looks so dirty) :
prepend_view_path "#{Rails.root}/vendor/private_gems/front-0.0.2/app/views/front"
I doesn't work, just crash the app ...
And I'm stuck here. Maybe my design is wrong?