diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-22 13:44:16 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-22 13:44:16 +0000 |
commit | a04b1f3d8a54aaec988c264267cf9f2c2340f275 (patch) | |
tree | 024a0ed444df4dd0f3414b789b1018f9bd20ebad /actionpack/lib | |
parent | f408fcd610c83d29effba92db29c35f7653187b6 (diff) | |
download | rails-a04b1f3d8a54aaec988c264267cf9f2c2340f275.tar.gz rails-a04b1f3d8a54aaec988c264267cf9f2c2340f275.tar.bz2 rails-a04b1f3d8a54aaec988c264267cf9f2c2340f275.zip |
Added more informative exception when using helper :some_helper and the helper requires another file that fails, you'll get an error message tells you what file actually failed to load, rather than falling back on assuming it was the helper file itself #346 [dblack]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@250 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/helpers.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/helpers.rb b/actionpack/lib/action_controller/helpers.rb index 06bbd56283..0e1ff7dd16 100644 --- a/actionpack/lib/action_controller/helpers.rb +++ b/actionpack/lib/action_controller/helpers.rb @@ -55,8 +55,13 @@ module ActionController #:nodoc: class_name = Inflector.camelize(file_name) begin require_dependency(file_name) - rescue LoadError - raise LoadError, "Missing helper file helpers/#{file_name}.rb" + rescue LoadError => load_error + requiree = / -- (.*?)(\.rb)?$/.match(load_error).to_a[1] + if requiree == file_name + raise LoadError, "Missing helper file helpers/#{file_name}.rb" + else + raise LoadError, "Can't load file: #{requiree}" + end end raise ArgumentError, "Missing #{class_name} module in helpers/#{file_name}.rb" unless Object.const_defined?(class_name) add_template_helper(Object.const_get(class_name)) |