Any tips on adding plugin specific routes? I'd like to add them directly in my plugin if possible.
on 2007-09-29 12:57
on 2007-09-29 13:08
Check the documentation for the #from_plugin addition to routing...
on 2007-09-30 00:34
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.
on 2007-09-30 00:45
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