diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2007-01-28 17:29:51 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2007-01-28 17:29:51 +0000 |
commit | 2cc9c8135c57671013a0b89fd683654cb6782676 (patch) | |
tree | 4c7bb29cff673c84eafa009a366f902731afdff5 /actionpack/lib | |
parent | 17a9405b584d7bd2ceb05f9310112a1d8a00b6ae (diff) | |
download | rails-2cc9c8135c57671013a0b89fd683654cb6782676.tar.gz rails-2cc9c8135c57671013a0b89fd683654cb6782676.tar.bz2 rails-2cc9c8135c57671013a0b89fd683654cb6782676.zip |
Allow Routes to generate all urls for a set of options by specifying :generate_all => true. References #1739.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6082 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index f5faca71ca..5b888443d8 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -1214,6 +1214,7 @@ module ActionController def generate(options, recall = {}, method=:generate) named_route_name = options.delete(:use_route) + generate_all = options.delete(:generate_all) if named_route_name named_route = named_routes[named_route_name] options = named_route.parameter_shell.merge(options) @@ -1249,6 +1250,14 @@ module ActionController action = merged[:action] raise RoutingError, "Need controller and action!" unless controller && action + + if generate_all + # Used by caching to expire all paths for a resource + return routes.collect do |route| + route.send(method, options, merged, expire_on) + end.compact + end + # don't use the recalled keys when determining which routes to check routes = routes_by_controller[controller][action][options.keys.sort_by { |x| x.object_id }] |