diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-26 08:51:50 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-26 08:52:20 -0600 |
commit | f74fbf9d326091200121d42cd895588d5371daa7 (patch) | |
tree | 41ce02cd407527e32b366ea79ba43d8c241fc4a2 /actionpack | |
parent | d7de1c76cad28f52fc62693d415a07abf6c86ef5 (diff) | |
download | rails-f74fbf9d326091200121d42cd895588d5371daa7.tar.gz rails-f74fbf9d326091200121d42cd895588d5371daa7.tar.bz2 rails-f74fbf9d326091200121d42cd895588d5371daa7.zip |
Keep ActionController::Base.helpers_dir around for a bit longer
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/helpers.rb | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb index ef3b89db14..0ebdf07911 100644 --- a/actionpack/lib/action_controller/metal/helpers.rb +++ b/actionpack/lib/action_controller/metal/helpers.rb @@ -57,14 +57,10 @@ module ActionController module ClassMethods def helpers_dir - ActiveSupport::Deprecation.warn "ActionController::Base.helpers_dir is deprecated. " << - "Please use ActionController::Base.helpers_path (which returns an array)" self.helpers_path end def helpers_dir=(value) - ActiveSupport::Deprecation.warn "ActionController::Base.helpers_dir= is deprecated. " << - "Please use ActionController::Base.helpers_path= (which is an array)" self.helpers_path = Array(value) end @@ -91,42 +87,42 @@ module ActionController @helper_proxy ||= ActionView::Base.new.extend(_helpers) end - private - # Overwrite _modules_for_helpers to accept :all as argument, which loads - # all helpers in helpers_dir. - # - # ==== Parameters - # args<Array[String, Symbol, Module, all]>:: A list of helpers - # - # ==== Returns - # Array[Module]:: A normalized list of modules for the list of - # helpers provided. - def _modules_for_helpers(args) - args += all_application_helpers if args.delete(:all) - super(args) - end + private + # Overwrite _modules_for_helpers to accept :all as argument, which loads + # all helpers in helpers_dir. + # + # ==== Parameters + # args<Array[String, Symbol, Module, all]>:: A list of helpers + # + # ==== Returns + # Array[Module]:: A normalized list of modules for the list of + # helpers provided. + def _modules_for_helpers(args) + args += all_application_helpers if args.delete(:all) + super(args) + end - def default_helper_module! - module_name = name.sub(/Controller$/, '') - module_path = module_name.underscore - helper module_path - rescue MissingSourceFile => e - raise e unless e.is_missing? "helpers/#{module_path}_helper" - rescue NameError => e - raise e unless e.missing_name? "#{module_name}Helper" - end + def default_helper_module! + module_name = name.sub(/Controller$/, '') + module_path = module_name.underscore + helper module_path + rescue MissingSourceFile => e + raise e unless e.is_missing? "helpers/#{module_path}_helper" + rescue NameError => e + raise e unless e.missing_name? "#{module_name}Helper" + end - # Extract helper names from files in app/helpers/**/*_helper.rb - def all_application_helpers - helpers = [] - helpers_path.each do |path| - extract = /^#{Regexp.quote(path)}\/?(.*)_helper.rb$/ - helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') } + # Extract helper names from files in app/helpers/**/*_helper.rb + def all_application_helpers + 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 - helpers.sort! - helpers.uniq! - helpers - end end end end |