# Routes?

**URL:** <https://www.ruby-forum.com/t/routes/115858>\
**Category:** Engines Development\
**Created:** [September 29, 2007, 10:57am UTC](https://www.ruby-forum.com/t/routes/115858 "2007-09-29T10:57:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nshb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@nshb](https://www.ruby-forum.com/u/nshb)\
**Post date:** [September 29, 2007, 10:57am UTC](https://www.ruby-forum.com/t/routes/115858/1 "2007-09-29T10:57:46Z")

</div>

Any tips on adding plugin specific routes? I’d like to add them directly  
in  
my plugin if possible.

---

<div class="post-metadata">

**Author:** ![nshb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@nshb](https://www.ruby-forum.com/u/nshb)\
**Post date:** [September 29, 2007, 11:08am UTC](https://www.ruby-forum.com/t/routes/115858/2 "2007-09-29T11:08:18Z")

</div>

Check the documentation for the #from\_plugin addition to routing…

---

<div class="post-metadata">

**Author:** ![nshb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@nshb](https://www.ruby-forum.com/u/nshb)\
**Post date:** [September 29, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/routes/115858/3 "2007-09-29T22:34:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nshb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@nshb](https://www.ruby-forum.com/u/nshb)\
**Post date:** [September 29, 2007, 10:45pm UTC](https://www.ruby-forum.com/t/routes/115858/4 "2007-09-29T22:45:23Z")

</div>

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
