aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2015-01-19 00:52:40 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2015-01-19 00:52:40 -0200
commit53919bbfd2b3232ec66e0cdea7b387725653ab43 (patch)
treeb9f4aa969e712e18bd2fb0b03a04b1fa9b1959b1 /actionpack/lib
parent0b0e9e8336772cd2543d3426de20383b7467bb2f (diff)
parent8a8dac80bb9aa173617a456f187b3fff56b4c347 (diff)
downloadrails-53919bbfd2b3232ec66e0cdea7b387725653ab43.tar.gz
rails-53919bbfd2b3232ec66e0cdea7b387725653ab43.tar.bz2
rails-53919bbfd2b3232ec66e0cdea7b387725653ab43.zip
Merge pull request #18483 from rono23/fix-name_for_action-in-routing
Fix name_for_action in routing
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 8b04dfaa45..f2c9e7b1a0 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1739,9 +1739,10 @@ module ActionDispatch
member_name = parent_resource.member_name
end
- name = @scope.action_name(name_prefix, prefix, collection_name, member_name)
+ action_name = @scope.action_name(name_prefix, prefix, collection_name, member_name)
+ candidate = action_name.select(&:present?).join('_')
- if candidate = name.compact.join("_").presence
+ unless candidate.empty?
# If a name was not explicitly given, we check if it is valid
# and return nil in case it isn't. Otherwise, we pass the invalid name
# forward so the underlying router engine treats it and raises an exception.