diff options
-rw-r--r-- | actionpack/lib/abstract_controller/helpers.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index 772af86770..c36b210e23 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -135,8 +135,7 @@ module AbstractController begin require_dependency(file_name) rescue LoadError => e - e.instance_variable_set(:@path, "helpers/#{e.path}") - raise + raise MissingHelperError.new(e, file_name) end file_name.camelize.constantize when Module @@ -147,6 +146,15 @@ module AbstractController end 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" % error) + end + end + private # Makes all the (instance) methods in the helper module available to templates # rendered through this controller. |