aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-05 15:31:51 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-05 15:31:51 +0000
commit4fe0248f57f98d7b3c9095bd5843fb5b10320c06 (patch)
treea2b7c343db1262ddde5eb368da7bc705aa5a5496
parent3b1d271e02e3f5b468b2a1ed3fc2a8bd2f228bd4 (diff)
downloadrails-4fe0248f57f98d7b3c9095bd5843fb5b10320c06.tar.gz
rails-4fe0248f57f98d7b3c9095bd5843fb5b10320c06.tar.bz2
rails-4fe0248f57f98d7b3c9095bd5843fb5b10320c06.zip
Fixed routing regression on index exception
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1713 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/lib/action_controller/routing.rb1
-rw-r--r--actionpack/test/controller/routing_test.rb6
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index 64657a3821..f8ca5e0930 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -363,6 +363,7 @@ module ActionController
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] == ?/
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 1243b0a6a9..16e9baf6e8 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -689,10 +689,14 @@ class RouteSetTests < Test::Unit::TestCase
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