aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 23b13d1d5d..0a6cd63b56 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -736,8 +736,12 @@ module ActionDispatch
end
elsif resource_method_scope?
path = path_for_custom_action
- options[:action] ||= action
- options[:as] = name_for_action(options[:as]) if options[:as]
+ if action =~ /^[a-zA-Z][_a-zA-Z0-9]*$/
+ options[:action] ||= action
+ options[:as] = name_for_action(action, options[:as])
+ else
+ options[:as] = name_for_action(options[:as]) if options[:as]
+ end
args.push(options)
with_exclusive_scope do