diff options
author | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-24 23:59:29 +0100 |
---|---|---|
committer | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-24 23:59:29 +0100 |
commit | 90e9e46576c0a8d57887484cd4f3f51b3b6cce3a (patch) | |
tree | de254a8fd31ae36f8b9371c9f0e645c7ed1b727d /actionpack/lib/action_controller/metal | |
parent | 0ece244feec236f57fb2f55ea564409f25475923 (diff) | |
parent | 4e96442c4e404141830b2d7f0d850b6556190b39 (diff) | |
download | rails-90e9e46576c0a8d57887484cd4f3f51b3b6cce3a.tar.gz rails-90e9e46576c0a8d57887484cd4f3f51b3b6cce3a.tar.bz2 rails-90e9e46576c0a8d57887484cd4f3f51b3b6cce3a.zip |
Merge branch 'master' of github.com:mikel/rails
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/helpers.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb index cdd14560e1..0e3db86861 100644 --- a/actionpack/lib/action_controller/metal/helpers.rb +++ b/actionpack/lib/action_controller/metal/helpers.rb @@ -50,9 +50,8 @@ module ActionController include AbstractController::Helpers included do - # Set the default directory for helpers - extlib_inheritable_accessor(:helpers_dir) do - defined?(Rails.root) ? "#{Rails.root}/app/helpers" : "app/helpers" + extlib_inheritable_accessor(:helpers_path) do + defined?(Rails::Application) ? Rails::Application.paths.app.helpers.to_a : [] end end @@ -105,10 +104,16 @@ module ActionController raise e unless e.missing_name? "#{module_name}Helper" end - # Extract helper names from files in app/helpers/**/*.rb + # Extract helper names from files in app/helpers/**/*_helper.rb def all_application_helpers - extract = /^#{Regexp.quote(helpers_dir)}\/?(.*)_helper.rb$/ - Dir["#{helpers_dir}/**/*_helper.rb"].map { |file| file.sub extract, '\1' } + helpers = [] + helpers_path.each do |path| + extract = /^#{Regexp.quote(path)}\/?(.*)_helper.rb$/ + helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') } + end + helpers.sort! + helpers.uniq! + helpers end end end |