> > If the community feels that controlling the positioning of the routes > is necessary, we should be pursuing this as part of the Rails core > implementation, i.e. with tickets and patches and +1s. > I have a use-case for needing a catch-all route from a plugin/engine. Under the native Rails engines implementation, its not possible (without some hackery) to install the plugin routes last (or more specifically, wherever I choose them to be installed). I agree the place for this is in Rails core, but I wanted to get your take on my idea of providing a "bundling" and unbundling of routes. i.e. from a plugin's routes file: ActionController::Routing::Routes.bundle(:my_bundle_name) do |map| map.connect '*path', :controller => 'whatever' end Then in the main routes file: map.unbundle :my_bundle_name You could have multiple bundles defined and "stored", which get inserted wherever you choose in the main routes file. I guess this is a lot like map.from_plugin, but it allows for finer grained "chunks" of routes. Comments welcome!
on 2009-04-21 18:34
on 2009-04-29 15:02
On Tuesday 21 April 2009 16:33:07 Michael Klett wrote: > on my idea of providing a "bundling" and unbundling of routes. > > You could have multiple bundles defined and "stored", which get inserted > wherever you choose in the main routes file. I guess this is a lot like > map.from_plugin, but it allows for finer grained "chunks" of routes. > > Comments welcome! I'll be happy if plugin routes could be overwritten with application specific routes. Is there any case where you want to define routes with less precedence than the routes from the plugin?
on 2009-04-29 16:50
Antonio Tapiador del Dujo wrote: >> >> > routes. > Is there any case where you want to define routes with less precedence than > the routes from the plugin? > I can't think of one off the top of my head, but there's certainly cases where you need to have the plugin order maintained. I have a set of full-stack plugins I use for web site design, and the main site info is a plugin as well. I need the order to be: Core plugin, Verticals plugins, Site plugin, so my core plugin can handle lots of default behavior, my verticals can add their functionality, and my site plugin can override anything it needs to. Not sure how best to approach this - I thought the map.from_plugin was a fine solution, not sure how DHH & co feel about adding something like it back in, but we need *something* to handle deconflicting plugin routes. The bundle/unbundle semantic above is a nice approach, in that it provides everything #from_plugin provided and more so, and is more generic to boot. +1? -Rob
on 2009-05-01 22:01
Your wish is my command: https://rails.lighthouseapp.com/projects/8994-ruby... #ticket-329-20 Please review, test, support or decry as appropriate! James