aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2009-12-20 20:37:36 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-12-20 20:37:36 -0800
commit3ff9e9ee147b682cb13aed4c057e750228892f42 (patch)
tree9bdc91718b07b3c50837e78ecddf44685c2896f9 /actionpack/lib/action_dispatch/routing
parent8763b78f8949f904dd0b53017555451b83f06884 (diff)
downloadrails-3ff9e9ee147b682cb13aed4c057e750228892f42.tar.gz
rails-3ff9e9ee147b682cb13aed4c057e750228892f42.tar.bz2
rails-3ff9e9ee147b682cb13aed4c057e750228892f42.zip
Its now possible to use match 'stuff' => 'what#stuff' instead of using the :to for simple routes
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 57e992d7dc..46163706c3 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -39,9 +39,13 @@ module ActionDispatch
end
def match(*args)
- options = args.extract_options!
-
- path = args.first
+ if args.one? && args.first.is_a?(Hash)
+ path = args.first.keys.first
+ options = { :to => args.first.values.first }
+ else
+ path = args.first
+ options = args.extract_options!
+ end
conditions, defaults = {}, {}