This project is archived and is in readonly mode.

#418 ✓invalid
Comron Sattari

Add option to clear routes when calling draw.

Reported by Comron Sattari | June 14th, 2008 @ 07:39 PM | in 3.x

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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages