aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2017-02-20 13:54:06 +0000
committerAndrew White <andrew.white@unboxed.co>2017-02-21 15:30:46 +0000
commite96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1 (patch)
tree23d81d0dbc88384f7834e74ed9b3cbf9262c0ffa /actionpack/lib/action_dispatch/routing/mapper.rb
parent47a27e8950ad00654e2ba0420cefd87269e08055 (diff)
downloadrails-e96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1.tar.gz
rails-e96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1.tar.bz2
rails-e96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1.zip
Only accept symbols and strings for Mapper#direct
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 474856b23a..fceadc7039 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -2056,7 +2056,12 @@ module ActionDispatch
# NOTE: It is the url helper's responsibility to return the correct
# set of options to be passed to the `url_for` call.
def direct(name, options = {}, &block)
- @set.add_url_helper(name, options, &block)
+ case name
+ when String, Symbol
+ @set.add_url_helper(name, options, &block)
+ else
+ raise ArgumentError, "The direct method only accepts a string or symbol"
+ end
end
end