I have a Rails Engine that I would like to share with a container. I would like to support all the URL assistants from the main application layout to make integration trivial. That is, to support layouts with helpers from the container application:
= link_to "Signup", new_user_path = link_to "Login", new_user_path ...
It causes:
undefined local variable or method `new_user_path 'for # <#: 0x007f9bf9a4a168>
I can fix this by changing application.html (in the container application) to:
= link_to "Signup", main_app.new_user_path = link_to "Login", main_app.new_user_path
But the goal is to ensure that the integration of the engine does not require users to change the existing functioning of application.html .
I believe that I can also fix errors by removing isolate_namespace Example from lib/example/engine.rb , but this breaks almost everything in the engine.
In any case, in order to allow the helpers of the container application and explicitly leak my helpers of my engines to avoid conflicts? (i.e. using example.root_path instead of root_path )?
ruby-on-rails rails-engines
Kevin sylvestre
source share