diff options
author | José Valim <jose.valim@gmail.com> | 2010-08-24 10:09:06 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-24 10:26:25 -0300 |
commit | b4f304b7b68e0b4fd780cc6d0944edefc362669d (patch) | |
tree | d8c394df4931ebd8cf9aff98591bf8efb0c64136 /actionpack/lib | |
parent | 2fb0cbec024c5b51451deab7e390e2d4f712cf8f (diff) | |
download | rails-b4f304b7b68e0b4fd780cc6d0944edefc362669d.tar.gz rails-b4f304b7b68e0b4fd780cc6d0944edefc362669d.tar.bz2 rails-b4f304b7b68e0b4fd780cc6d0944edefc362669d.zip |
Fix a bug where symbols and strings were not behaving the same in the router. [#5431 state:resolved]
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0a6cd63b56..4dc2fc086e 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -726,22 +726,17 @@ module ActionDispatch path = options.delete(:path) action = args.first - if action.is_a?(Symbol) + if action && action.to_s =~ /^[\w_]+$/ path = path_for_action(action, path) - options[:to] ||= action - options[:as] = name_for_action(action, options[:as]) + options[:action] ||= action + options[:as] = name_for_action(action, options[:as]) with_exclusive_scope do return super(path, options) end elsif resource_method_scope? path = path_for_custom_action - 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 + options[:as] = name_for_action(options[:as]) if options[:as] args.push(options) with_exclusive_scope do |