This project is archived and is in readonly mode.
Plugin routes override application routes
Reported by James Adam | May 1st, 2009 @ 03:25 PM | in 3.x
At the moment, plugin routes are loaded before application routes. This means that it's possible for a plugin to override anything defined in the application's routes.rb.
Here's a small patch to fix it - I've adopted what I believe is the simplest approach without considering how to split apart the route loading process.
Comments and changes to this ticket
-
Nick Quaranto May 1st, 2009 @ 04:21 PM
+1 for this. During the process of converting Clearance to a Rails engine, we had to hack into the routes loading process so it was possible to override routes in the app's config/routes.rb with those set in the plugin.
The hack is the first tip listed here: http://giantrobots.thoughtbot.co...
-
adlongwell May 5th, 2009 @ 06:58 PM
+1 I'm working on a CMS plugin system that could really benefit from this.
-
jbasdf July 21st, 2009 @ 04:54 PM
- I've used the technique listed by here: Nick http://giantrobots.thoughtbot.com/2009/4/23/tips-for-writing-your-o.... It would be nice if that was the default.
-
Jason Ronallo September 11th, 2009 @ 07:54 PM
+1 We're running into this problem with the Blacklight plugin where different sites need the ability to override routes.
-
Bess September 11th, 2009 @ 08:43 PM
+1 Fixing this would really help us out for Blacklight: http://projectblacklight.org
-
Naomi Dushay September 11th, 2009 @ 11:23 PM
+1 to fix this - plugin route overrides are broken without this fix.
-
Francesc Esplugas September 13th, 2009 @ 07:06 PM
Maybe you want routes from the plugin to be loaded first or last. In my opinion there should be a convention to define which routes have to be defined at the beginning and which routes at the end.
Are you sure you want your routes to be loaded at the end if you have the default routes active? Some people doesn't remove them.
I've developed an engine called Typus (http://intraducibles.com/projects/typus) and a few months back some users complained about how routes worked because they where loaded after the routes of the application. Now routes are loaded normally with a :path_prefix and everything is working nice.
-
Eric Davis September 15th, 2009 @ 12:55 AM
+1 I'd like to see this as part of the core Rails because it makes building modular applications easier. I've built a small prototype of this as a plugin and it's working great with Redmine so far.
http://github.com/edavis10/prepend_engine_routes
Eric Davis
-
Santiago Pastorino February 2nd, 2011 @ 05:02 PM
- State changed from new to open
- Tag changed from 2.3.2, bug, engines, patch, plugin, route to 232, bug, engines, patch, plugin, route
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 05:02 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>