aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-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