diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2016-11-11 20:05:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-11 20:05:10 +0000 |
commit | 6b830dc930a5d684c05b028757b06834df4d064d (patch) | |
tree | cce822e4496b50a6bd5b121a540447f59f59e3e4 /actionpack/lib/abstract_controller/helpers.rb | |
parent | e4b0a5f66ebd2b7f29e4f868d2f6b2504df091e6 (diff) | |
parent | 9b103311d5d266fa509f5da8825ea5daecba1836 (diff) | |
download | rails-6b830dc930a5d684c05b028757b06834df4d064d.tar.gz rails-6b830dc930a5d684c05b028757b06834df4d064d.tar.bz2 rails-6b830dc930a5d684c05b028757b06834df4d064d.zip |
Merge pull request #26962 from rails/fix-3-2-stable-on-ruby-2-3
Fix Rails 3-2-stable on Ruby 2.3.1
Diffstat (limited to 'actionpack/lib/abstract_controller/helpers.rb')
-rw-r--r-- | actionpack/lib/abstract_controller/helpers.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index 77cc4c07d9..7a9055a679 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -12,6 +12,15 @@ module AbstractController self._helper_methods = Array.new end + class MissingHelperError < LoadError + def initialize(error, path) + @error = error + @path = "helpers/#{path}.rb" + set_backtrace error.backtrace + super("Missing helper file helpers/%s.rb" % path) + end + end + module ClassMethods # When a class is inherited, wrap its helper module in a new module. # This ensures that the parent class's module can be changed @@ -132,7 +141,11 @@ module AbstractController case arg when String, Symbol file_name = "#{arg.to_s.underscore}_helper" - require_dependency(file_name, "Missing helper file helpers/%s.rb") + begin + require_dependency(file_name) + rescue LoadError => e + raise MissingHelperError.new(e, file_name) + end file_name.camelize.constantize when Module arg |