diff options
author | rono23 <rono23@gmail.com> | 2015-01-13 19:40:56 +0900 |
---|---|---|
committer | rono23 <rono23@gmail.com> | 2015-01-19 10:32:27 +0900 |
commit | 8a8dac80bb9aa173617a456f187b3fff56b4c347 (patch) | |
tree | c3a7d47e437efa5e037ef1861c446790bd691314 /actionpack/lib/action_dispatch | |
parent | 19b4b0dff1820b13db35b7a75dfb7d06f7240ecf (diff) | |
download | rails-8a8dac80bb9aa173617a456f187b3fff56b4c347.tar.gz rails-8a8dac80bb9aa173617a456f187b3fff56b4c347.tar.bz2 rails-8a8dac80bb9aa173617a456f187b3fff56b4c347.zip |
Fix name_for_action in routing
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 |
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. |