aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-06-14 09:01:43 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-06-14 09:01:58 -0700
commit99c9d18601539c7e7e87f26bb047add1f93072af (patch)
tree9ccc6d6cbaa24dd765569e58b2ffecc60f30979f /actionpack
parentf278b067891b3a3e3462e92ada72e8dc5f24797b (diff)
downloadrails-99c9d18601539c7e7e87f26bb047add1f93072af.tar.gz
rails-99c9d18601539c7e7e87f26bb047add1f93072af.tar.bz2
rails-99c9d18601539c7e7e87f26bb047add1f93072af.zip
Wrap up missing helper exceptions
The `path` method on missing helper errors is inconsistent with the implementation on LoadError in Ruby 2.0. Wrap up the missing helper exceptions so that the inconsistent behavior is mirrored in Ruby 2.0 (until we can figure out *why* it's inconsistent).
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/abstract_controller/helpers.rb12
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.