Fix precidence of app routes over plugin/engine routes

Hi all,

I submitted a simple patch to fix the problem where plugin routes override application routes (it ought to be the other way around). The ticket is here: #2592 Plugin routes override application routes - Ruby on Rails - rails

In summary, I've added a new method to the Routes class to allow the Initializer to prepend the application routes to the configuration_files array, instead of pushing it on at the end. Plugin routes are added when the plugin is loaded, which occurs before the application routes are added.

There are other ways to patch this, including breaking the add-plugin- routes into a seperate step in the initializer, but I felt that such changes might need to be made with more discussion about how the plugin loading process is structured as a whole.

Anyway - please take a look at the patch, hopefully people will find it sufficient.

Thanks,

James

Looking at #1450 Add way for plugins to map routes - Ruby on Rails - rails, I believe the current load order is by design, rather than "a problem". Rather than starting a debate over the default, it might be more useful to think about an expanded API as outlined in the earlier ticket.

Mike

While that ticket is definitely related, I'm not sure that the discussion indicates that the current functionality is by design. Perhaps David, Josh or Rich could clarify (as the original participants)?

Personally, I'm in (naturally!) favour of a richer API that allows control over plugin route precedence, but this patch provides a substantial portion of the value for a fraction of the effort, and makes plugin routes a little better while we figure out a better API for the ideal functionality. I'm happy to contribute ideas and code to such an effort, but worry that focussing solely on it jeopardises making any small but beneficial changes in the near future.

Hope that makes sense,

James

Complementing my patch on Ticket 1450, you might also be interested in the patch I added to Ticket 329, which provides an expanded API, as requested.

As always, feedback is greatly appreciated, and thanks for engaging so far.

James