Permalink
Browse files

Fixed routing regression on index exception

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1713 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Jul 5, 2005
1 parent 3b1d271 commit 4fe0248f57f98d7b3c9095bd5843fb5b10320c06
Showing with 6 additions and 1 deletion.
  1. +1 −0 actionpack/lib/action_controller/routing.rb
  2. +5 −1 actionpack/test/controller/routing_test.rb
@@ -363,6 +363,7 @@ def generate(options, request_or_recall_hash = {})
use_recall = true
controller = options[:controller]
+ options[:action] ||= 'index' if controller
recall_controller = recall[:controller]
if (recall_controller && recall_controller.include?(?/)) || (controller && controller.include?(?/))
recall = {} if controller && controller[0] == ?/
@@ -689,10 +689,14 @@ def test_backwards
rs.connect ':controller/:action/:id'
end
- assert_equal ['/page/20', {}], rs.generate(:controller => 'pages', :id => 20)
+ assert_equal ['/page/20', {}], rs.generate({:id => 20}, {:controller => 'pages'})
assert_equal ['/page/20', {}], rs.generate(:controller => 'pages', :id => 20, :action => 'show')
assert_equal ['/pages/boo', {}], rs.generate(:controller => 'pages', :action => 'boo')
end
+
+ def test_action_expiry
+ assert_equal ['/content', {}], rs.generate({:controller => 'content'}, {:controller => 'content', :action => 'show'})
+ end
end
end

0 comments on commit 4fe0248

Please sign in to comment.