Forum: Ruby on Rails Modifying routes in plugins

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8b6e9047a02f6756e0dcb36863463b5b?d=identicon&s=25 Luke Amdor (Guest)
on 2005-12-12 21:04
(Received via mailing list)
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
luke@absoluterubbish.net

/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
8b6e9047a02f6756e0dcb36863463b5b?d=identicon&s=25 Luke Amdor (Guest)
on 2005-12-13 06:12
(Received via mailing list)
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
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

--
Luke Amdor
luke@absoluterubbish.net

/usr/bin/fortune |

The following statement is not true.  The previous statement is true.
This topic is locked and can not be replied to.