diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-30 07:14:48 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:10 +0200 |
commit | c7664d112fadb313146da33f48d1da318f249927 (patch) | |
tree | 926ace3a678884f4fe114a0ab2f9c112c4d4c7f2 /actionpack/lib/action_controller/metal/helpers.rb | |
parent | 99131939316230065b4297573d080d1585e4e5a7 (diff) | |
download | rails-c7664d112fadb313146da33f48d1da318f249927.tar.gz rails-c7664d112fadb313146da33f48d1da318f249927.tar.bz2 rails-c7664d112fadb313146da33f48d1da318f249927.zip |
Include application's helpers and router helpers by default, but include engine's ones for controllers inside isolated namespace
Diffstat (limited to 'actionpack/lib/action_controller/metal/helpers.rb')
-rw-r--r-- | actionpack/lib/action_controller/metal/helpers.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb index 4b6897c5dd..c5d7842db3 100644 --- a/actionpack/lib/action_controller/metal/helpers.rb +++ b/actionpack/lib/action_controller/metal/helpers.rb @@ -101,8 +101,12 @@ module ActionController # Extract helper names from files in <tt>app/helpers/**/*_helper.rb</tt> def all_application_helpers + all_helpers_from_path(helpers_path) + end + + def all_helpers_from_path(path) helpers = [] - Array.wrap(helpers_path).each do |path| + Array.wrap(path).each do |path| extract = /^#{Regexp.quote(path.to_s)}\/?(.*)_helper.rb$/ helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') } end |