Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 4fe0248f57f98d7b3c9095bd5843fb5b10320c06 1 parent 3b1d271
@dhh dhh authored
View
1  actionpack/lib/action_controller/routing.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] == ?/
View
6 actionpack/test/controller/routing_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.