Forum: Rails Engines development Routes?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2007-09-29 10:57
(Received via mailing list)
Any tips on adding plugin specific routes? I'd like to add them directly
in
my plugin if possible.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2007-09-29 11:08
(Received via mailing list)
Check the documentation for the #from_plugin addition to routing...
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2007-09-29 22:34
(Received via mailing list)
I had a chance to look at that last night, but still I find myself
wondering
why I am not able to directly tie into the routes, automatically.

I'd like to not have to require any installation steps for routes if
possible. Any recommendations? Such as having a conf option in my plugin
to
say that all engine routes go first, then use the application routes.
Didn't
sound like this was possible reading the specs.. but advice on how to
get it
to work this way would be awesome.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2007-09-29 22:45
(Received via mailing list)
Indeed it's not possible as things stand, and that's by design. It
would be impossible for a plugin writer to know, for certain and in
advance, what priority the routes he/she wishes to contribute should
have.

The point of plugins, IMHO, is not for them to be "plug and play".
They should simply provide a piece of functionality which is easier to
use than it would be for the developer to write and test themselves.
The end user - who is a developer themselves - still ought to take
responsibility for how their application uses that functionality. In
this case, it's my feeling that this means they should know where best
to put your plugins routes.

That said, if you're hell-bent on having your plugin's routes
automagically injected, you probably need to starting hacking around
with the ActionController::Routing::Routes.draw method. Perhaps you
might use alias_method_chain to wrap it in a method that adds the
routes for your own plugin.

- James
This topic is locked and can not be replied to.