Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add option to clear routes when calling draw.

#418

Applying the patch below will allow a plugin developer nicer access to adding routes in init.rb.

Instead of :

require 'dispatcher'
Dispatcher.to_prepare :foo_plugin_routes do
  map = ActionController::Routing::RouteSet::Mapper.new(ActionController::Routing::Routes)
  map.resources :postings do |postings|
    postings.resources :comments
  end
  ActionController::Routing::Routes.send(:install_helpers)
end

You can :

require 'dispatcher'
Dispatcher.to_prepare :foo_plugin_routes do
  ActionController::Routing::Routes.draw(false) do |map|
    map.resources :postings do |postings|
      postings.resources :comments
    end
  end
end

Reported by Comron Sattari · June 14th, 2008 @ 07:39 PM

State: invalid
Milestone: 3.x
Assigned to: Andrew White Andrew White
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone cleared.
    • State changed from new to open
    • Assigned user set to Jeremy Kemper

    June 16th, 2008 @ 12:24 PM

  2. José Valim
    José Valim
    • Tag set to 2.1, actionpack, patch, plugins, routing, tested

    +1

    June 30th, 2008 @ 11:58 PM

  3. Jeremy Kemper
    Jeremy Kemper

    When looking at the code, passing a boolean doesn't reveal the intention of the API.

    How about using a separate method call instead of draw, such as add?

    August 28th, 2008 @ 07:53 AM

  4. Pratik
    Pratik
    • Milestone set to 2.x

    October 17th, 2008 @ 05:13 PM

  5. Pratik
    Pratik
    • State changed from open to incomplete
    • Assigned user changed from Jeremy Kemper to Michael Koziarski

    January 18th, 2009 @ 07:06 AM

  6. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  7. Neeraj Singh
    Neeraj Singh
    • Assigned user changed from Michael Koziarski to Andrew White
    • Importance changed from to

    This is an old ticket. A lot has changed in routing since then. Assigning it to Andrew to get his perspective on this.

    July 1st, 2010 @ 04:25 AM

  8. Andrew White
    Andrew White
    • State changed from incomplete to invalid

    There are much nicer ways for engines/plugins to add routes now - config/routes.rb being the easiest but also look at how Devise mixes a module into the new mapper for more flexibility of where routes appear, conciseness and extra functionality like authenticating routes.

    July 1st, 2010 @ 06:50 AM