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.
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.
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.