Modifying routes in plugins

Hi all,

I was wondering if it was at all possible to add routes without
destroying all the old routes that were defined in config/routes.rb.
I have been able to make new routes using
ActionContoller::Routing::Routes.draw do |map| … end , but doing so
wipes out all the old routes that I had defined. Do I have to reiterate
defining all the old routes in the plugin, but how? Thanks in advance,

Luke

Luke Amdor
[email protected]

/usr/bin/fortune |

I woke up a feelin’ mean
went down to play the slot machine
the wheels turned round,
and the letters read
“Better head back to Tennessee Jed”
– Grateful Dead

If anyone wants to know, here’s how I did it. All I did was make
ActionContoller::Routing::Routes#routes readable and then just put the
old routes back in like so:

class <<ActionController::Routing::Routes
attr_accessor :routes
end

old_routes = ActionController::Routing::Routes.routes
ActionController::Routing::Routes.draw do |map|
map.connect ‘caboose’, :controller => ‘caboose’,:action => ‘login’
old_routes.each do |route|
map.routes << route
end
end

It works pretty well so far. All routes are are preserved and named
routes work as well. You can also work through the routes and put your
routes in as you would like as well, but in my case, I just wanted mine
first.

Luke
On Mon, Dec 12, 2005 at 02:03:38PM -0600, Luke Amdor wrote:


– Grateful Dead


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Luke Amdor
[email protected]

/usr/bin/fortune |

The following statement is not true. The previous statement is true.