diff options
author | Byron Bischoff <byronb@gmail.com> | 2014-01-24 13:07:02 -0800 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-25 07:19:33 +0000 |
commit | 345555cd4cfd6fad68752292e5780387672e167e (patch) | |
tree | 6a8b07375a4d0aa1f968fd0263e8086682c4e5c8 /actionpack/lib | |
parent | 94ce51445eb70fb168640c0404b7fc1985365f67 (diff) | |
download | rails-345555cd4cfd6fad68752292e5780387672e167e.tar.gz rails-345555cd4cfd6fad68752292e5780387672e167e.tar.bz2 rails-345555cd4cfd6fad68752292e5780387672e167e.zip |
Transform dashes to underscores in resource route names
Fixes #13824
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6a4d7c3afa..d5eb770cb1 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1442,7 +1442,7 @@ module ActionDispatch action = action.to_s.dup if action =~ /^[\w\-\/]+$/ - options[:action] ||= action unless action.include?("/") + options[:action] ||= action.tr('-', '_') unless action.include?("/") else action = nil end @@ -1607,10 +1607,11 @@ module ActionDispatch def prefix_name_for_action(as, action) #:nodoc: if as - as.to_s + prefix = as elsif !canonical_action?(action, @scope[:scope_level]) - action.to_s + prefix = action end + prefix.to_s.tr('-', '_') if prefix end def name_for_action(as, action) #:nodoc: @@ -1637,7 +1638,6 @@ module ActionDispatch when :root [name_prefix, collection_name, prefix] else - prefix.gsub!(/\-/, '_') if prefix.is_a?(String) [name_prefix, member_name, prefix] end |