Forum: Rails Engines Re: Engines 2.3 compatibility

68950d608186c475d9b836b4777b7c3f?d=identicon&s=25 Michael Klett (Guest)
on 2009-04-21 16:34
(Received via mailing list)
>
> 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!
Fbdd0d26ec0146cbe4e22318fc5341b5?d=identicon&s=25 Antonio Tapiador del Dujo (Guest)
on 2009-04-29 13:02
(Received via mailing list)
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?
E862fb7db4f79f9f6a241c37094e290d?d=identicon&s=25 Rob Morris (Guest)
on 2009-04-29 14:50
(Received via mailing list)
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
Acd62030df551952268e84c8fff26a5b?d=identicon&s=25 James Adam (lazyatom)
on 2009-05-01 20:01
(Received via mailing list)
Your wish is my command:

https://rails.lighthouseapp.com/projects/8994-ruby...
#ticket-329-20

Please review, test, support or decry as appropriate!

James
This topic is locked and can not be replied to.