Changeset 6082
- Timestamp:
- 01/28/07 17:29:51 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/routing.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/routing_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r6081 r6082 1 1 *SVN* 2 3 * Allow Routes to generate all urls for a set of options by specifying :generate_all => true. Allows caching to properly set or expire all paths for a resource. References #1739. [Nicholas Seckar] 2 4 3 5 * Change the query parser to map empty GET params to "" rather than nil. Closes #5694. [Nicholas Seckar] trunk/actionpack/lib/action_controller/routing.rb
r6071 r6082 1215 1215 def generate(options, recall = {}, method=:generate) 1216 1216 named_route_name = options.delete(:use_route) 1217 generate_all = options.delete(:generate_all) 1217 1218 if named_route_name 1218 1219 named_route = named_routes[named_route_name] … … 1250 1251 1251 1252 raise RoutingError, "Need controller and action!" unless controller && action 1253 1254 if generate_all 1255 # Used by caching to expire all paths for a resource 1256 return routes.collect do |route| 1257 route.send(method, options, merged, expire_on) 1258 end.compact 1259 end 1260 1252 1261 # don't use the recalled keys when determining which routes to check 1253 1262 routes = routes_by_controller[controller][action][options.keys.sort_by { |x| x.object_id }] trunk/actionpack/test/controller/routing_test.rb
r6057 r6082 1720 1720 end 1721 1721 1722 def test_generate_all 1723 set.draw do |map| 1724 map.connect 'show_post/:id', :controller => 'post', :action => 'show' 1725 map.connect ':controller/:action/:id' 1726 end 1727 all = set.generate( 1728 {:action => 'show', :id => 10, :generate_all => true}, 1729 {:controller => 'post', :action => 'show'} 1730 ) 1731 assert_equal 2, all.length 1732 assert_equal '/show_post/10', all.first 1733 assert_equal '/post/show/10', all.last 1734 end 1735 1722 1736 end 1723 1737