aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-10-21 11:42:59 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-11-18 10:51:10 -0800
commit7459ba4f6c7d7b98fc0985255ccfd93186b0950f (patch)
treef422730584079969b72faf0da37a2971e1614c2b /actionpack
parent494ab25772ba5eca741fe98f6beb48954949993f (diff)
downloadrails-7459ba4f6c7d7b98fc0985255ccfd93186b0950f.tar.gz
rails-7459ba4f6c7d7b98fc0985255ccfd93186b0950f.tar.bz2
rails-7459ba4f6c7d7b98fc0985255ccfd93186b0950f.zip
pushing hash validation up
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb27
1 files changed, 14 insertions, 13 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 4c4b99c03e..d196f16600 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1255,25 +1255,26 @@ module ActionDispatch
options[:anchor] = true unless options.key?(:anchor)
+ if options[:on] && !VALID_ON_OPTIONS.include?(options[:on])
+ raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
+ end
+
paths.each { |path| decomposed_match(path, options.dup) }
self
end
def decomposed_match(path, options) # :nodoc:
- on = options.delete(:on)
- if VALID_ON_OPTIONS.include?(on)
- return send(on){ decomposed_match(path, options) }
- elsif on
- raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
- end
-
- case @scope[:scope_level]
- when :resources
- nested { decomposed_match(path, options) }
- when :resource
- member { decomposed_match(path, options) }
+ if on = options.delete(:on)
+ send(on) { decomposed_match(path, options) }
else
- add_route(path, options)
+ case @scope[:scope_level]
+ when :resources
+ nested { decomposed_match(path, options) }
+ when :resource
+ member { decomposed_match(path, options) }
+ else
+ add_route(path, options)
+ end
end
end