This project is archived and is in readonly mode.
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
-
Jeremy Kemper June 16th, 2008 @ 12:24 PM
- Milestone cleared.
- State changed from new to open
- Assigned user set to Jeremy Kemper
-
José Valim June 30th, 2008 @ 11:58 PM
- Tag set to 2.1, actionpack, patch, plugins, routing, tested
+1
-
Jeremy Kemper August 28th, 2008 @ 07:53 AM
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?
-
Pratik October 17th, 2008 @ 05:13 PM
- Milestone set to 2.x
-
Pratik January 18th, 2009 @ 07:06 AM
- State changed from open to incomplete
- Assigned user changed from Jeremy Kemper to Michael Koziarski
-
Neeraj Singh July 1st, 2010 @ 04:25 AM
- 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.
-
Andrew White July 1st, 2010 @ 06:50 AM
- 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.
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>