aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2018-08-23 20:56:57 +0930
committerGitHub <noreply@github.com>2018-08-23 20:56:57 +0930
commit8f92a72cb3fda9915151baab43922d92f581ed93 (patch)
tree6e9d71351162af20f5ce533b43fa4172d40ab13c /actionpack
parent123fe0c9ac559cb58a208c23a96669845f24dfb1 (diff)
parenteb68fec314322fc3d06baa3da1e41fc59efb4fa6 (diff)
downloadrails-8f92a72cb3fda9915151baab43922d92f581ed93.tar.gz
rails-8f92a72cb3fda9915151baab43922d92f581ed93.tar.bz2
rails-8f92a72cb3fda9915151baab43922d92f581ed93.zip
Merge pull request #33704 from matthewd/helper-path-with-size
Use string lengths instead of regexp to extract path
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb
index 22c84e440b..0faaac1ce4 100644
--- a/actionpack/lib/action_controller/metal/helpers.rb
+++ b/actionpack/lib/action_controller/metal/helpers.rb
@@ -100,8 +100,7 @@ module ActionController
# # => ["application", "chart", "rubygems"]
def all_helpers_from_path(path)
helpers = Array(path).flat_map do |_path|
- extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
- names = Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1'.freeze) }
+ names = Dir["#{_path}/**/*_helper.rb"].map { |file| file[_path.to_s.size + 1..-"_helper.rb".size - 1] }
names.sort!
end
helpers.uniq!