diff options
author | Andrew White <andrew.white@unboxed.co> | 2017-02-20 13:54:06 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2017-02-21 15:30:46 +0000 |
commit | e96da0a7beb483ed5e8a8096ff67b09ecc5ca7a1 (patch) | |
tree | 23d81d0dbc88384f7834e74ed9b3cbf9262c0ffa /actionpack/lib/action_dispatch/routing/mapper.rb | |
parent | 47a27e8950ad00654e2ba0420cefd87269e08055 (diff) | |
download | rails-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.rb | 7 |
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 |