diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-27 14:32:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-27 14:32:19 +0000 |
commit | a7116b6534ee192fd3c64ce927bae424acca2a22 (patch) | |
tree | 90b9298fc1b9456a574fb2f7eaaaa3d8b5c9455a /actionpack | |
parent | 5205e08e76ecb472784b7237fc8195c66689aa78 (diff) | |
download | rails-a7116b6534ee192fd3c64ce927bae424acca2a22.tar.gz rails-a7116b6534ee192fd3c64ce927bae424acca2a22.tar.bz2 rails-a7116b6534ee192fd3c64ce927bae424acca2a22.zip |
Make named routes work without hashes #1523 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1541 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 5d45eb829d..7e71a6057b 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -538,7 +538,7 @@ module ActionController def each(&block) @routes.each(&block) end def method_missing(name, *args) - return super(name, *args) unless args.length == 2 + return super(name, *args) unless (1..2).include?(args.length) route = connect(*args) NamedRoutes.name_route(route, name) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 3687b6ac77..923ea7db7c 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -661,6 +661,12 @@ class RouteSetTests < Test::Unit::TestCase x.send :include, ::ActionController::Routing::NamedRoutes x end + + def test_named_route_without_hash + rs.draw do |map| + rs.normal ':controller/:action/:id' + end + end end end |