diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/new_base/helpers.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/new_base/helpers.rb b/actionpack/lib/action_controller/new_base/helpers.rb index 60d1a6f775..8ddfc70607 100644 --- a/actionpack/lib/action_controller/new_base/helpers.rb +++ b/actionpack/lib/action_controller/new_base/helpers.rb @@ -16,7 +16,7 @@ module ActionController module ClassMethods def inherited(klass) - klass.__send__ :default_helper_module! + klass.class_eval { default_helper_module! unless name.blank? } super end @@ -92,16 +92,13 @@ module ActionController end def default_helper_module! - unless name.blank? - module_name = name.sub(/Controller$|$/, 'Helper') - module_path = module_name.split('::').map { |m| m.underscore }.join('/') - require_dependency module_path - helper module_name.constantize - end + module_name = name.sub(/Controller$/, '') + module_path = module_name.underscore + helper module_path rescue MissingSourceFile => e - raise e unless e.is_missing? module_path + raise e unless e.is_missing? "#{module_path}_helper" rescue NameError => e - raise e unless e.missing_name? module_name + raise e unless e.missing_name? "#{module_name}Helper" end # Extract helper names from files in app/helpers/**/*.rb |