[Rails] recent changes in routes

Chris Abad chris at integralimpressions.com
Wed Aug 9 06:06:17 GMT 2006


I'm writing a plugin that automatically creates a named route buy  
hijacking RouteSet's draw method. This no longer seems to work in  
edge rails. Anyone know what changes in routes effected this and what  
the preferred way would be now to automatically include route?

Here's the code that used to work:

class ActionController::Routing::RouteSet
   alias_method :__draw, :draw
   def draw
     old_routes = @routes
     @routes = []
     begin
        create_rcss_routes
        yield self
     rescue
        @routes = old_routes
        raise
     end
     write_generation
     write_recognition
   end
   def create_rcss_routes
      named_route 'plugin', "/ 
controller/:plugin", :controller=>'controller', :action=>'plugin'
   end
end


More information about the Rails mailing list