Changeset 8169
- Timestamp:
- 11/20/07 21:25:25 (1 year ago)
- Files:
-
- trunk/actionpack/lib/action_controller/routing.rb (modified) (3 diffs)
- trunk/actionpack/test/controller/routing_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/routing.rb
r8094 r8169 273 273 274 274 HTTP_METHODS = [:get, :head, :post, :put, :delete] 275 276 ALLOWED_REQUIREMENTS_FOR_OPTIMISATION = [:controller, :action].to_set 275 277 276 278 # The root paths which may contain controller files … … 354 356 @requirements = {} 355 357 @conditions = {} 358 @optimise = true 356 359 end 357 360 … … 1022 1025 route.conditions = conditions 1023 1026 1027 if !route.significant_keys.include?(:action) && !route.requirements[:action] 1028 route.requirements[:action] = "index" 1029 route.significant_keys << :action 1030 end 1031 1024 1032 # Routes cannot use the current string interpolation method 1025 1033 # if there are user-supplied :requirements as the interpolation 1026 1034 # code won't raise RoutingErrors when generating 1027 route.optimise = !options.key?(:requirements) 1028 if !route.significant_keys.include?(:action) && !route.requirements[:action] 1029 route.requirements[:action] = "index" 1030 route.significant_keys << :action 1035 if options.key?(:requirements) || route.requirements.keys.to_set != Routing::ALLOWED_REQUIREMENTS_FOR_OPTIMISATION 1036 route.optimise = false 1031 1037 end 1032 1038 trunk/actionpack/test/controller/routing_test.rb
r7898 r8169 213 213 x = setup_for_named_route 214 214 x.expects(:url_for).never 215 #x.send(:users_url)215 x.send(:users_url) 216 216 x.send(:users_path) 217 #x.send(:user_url, 2, :foo=>"bar")217 x.send(:user_url, 2, :foo=>"bar") 218 218 x.send(:user_path, 3, :bar=>"foo") 219 219 end 220 221 def test_optimized_named_route_with_host 222 rs.add_named_route :pages, 'pages', :controller => 'content', :action => 'show_page', :host => 'foo.com' 223 x = setup_for_named_route 224 x.expects(:url_for).with(:host => 'foo.com', :only_path => false, :controller => 'content', :action => 'show_page', :use_route => :pages).once 225 x.send(:pages_url) 226 end 227 220 228 end 221 229