figured it out: the solution here is to 

   - remove the isolate_namespace from the engine: this allows access to 
   the routes/route-helpers of the hosting app.
   - do not namespace the controller(app/my_controller instead of 
   app/my_plugin/my_controller) you are calling the layout from: otherwise, 
   this namespace gets prefixed


Am Dienstag, 10. Juli 2012 08:19:52 UTC+2 schrieb [email protected]:
>
> I'm currently trying to convert an existing non-engine-plugin (for 
> redmine) into an engine: Here I ran into some routing issues: a controller 
> in the plugin uses a layout from the hosting application, the hosting 
> application now tries to render links inside this layout within the context 
> of the plugin's controller, which fails, as the plugin does not define 
> them, only the hosting application does. 
>
> the edgeguide on routes(
> http://edgeguides.rubyonrails.org/engines.html#routes) says, qualifying 
> the main.app will solve this issue:
>
> <pre>
> link_to "Home", main_app.root_path 
> </pre>
>
> however, I cannot/do not want to rewrite *all* the links in the hosting 
> application: Is there a way to have rails fall back on the links of the 
> hosting-application, when a route is not found in the plugin? 
>
> A somewhat similar problem happens, when I use link_to with an url like: 
>
> <pre>
> link_to "My Account", {:controller => "my",:action => :account}
> </pre>
>
> which works fine, when called from the hosting-application(as the 
> my-controller exists there, but get's prefixed with the plugin's namespace, 
> when it is called from within a controller inside the plugin, which gives 
> a: 
>
> <pre> 
> ActionController::RoutingError (No route matches 
> {:controller=>"redmine_config/my", :action=>"account"}):
> </pre>
>
> as the plugin does not define the my-controller.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/6IgaWmZIirUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en-US.

Reply via email to