aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2014-10-25 13:58:38 +0200
committerXavier Noria <fxn@hashref.com>2014-10-25 14:06:33 +0200
commit8d7cf75684d5e76ef635f92125a51cb4c1c0fd3b (patch)
treec4bfcb63d28c26837ad8b607de9abe33de7b3de9 /actionpack/lib
parentae07806858072cd66611c165d1eed2a113e639e5 (diff)
downloadrails-8d7cf75684d5e76ef635f92125a51cb4c1c0fd3b.tar.gz
rails-8d7cf75684d5e76ef635f92125a51cb4c1c0fd3b.tar.bz2
rails-8d7cf75684d5e76ef635f92125a51cb4c1c0fd3b.zip
give a better error message for misspelled helpers
See comment in this patch for the rationale. References #16468
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/abstract_controller/helpers.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb
index 95c67d482b..df7382f02d 100644
--- a/actionpack/lib/abstract_controller/helpers.rb
+++ b/actionpack/lib/abstract_controller/helpers.rb
@@ -150,7 +150,17 @@ module AbstractController
rescue LoadError => e
raise AbstractController::Helpers::MissingHelperError.new(e, file_name)
end
- file_name.camelize.constantize
+
+ mod_name = file_name.camelize
+ begin
+ mod_name.constantize
+ rescue LoadError
+ # dependencies.rb gives a similar error message but its wording is
+ # not as clear because it mentions autoloading. To the user all it
+ # matters is that a helper module couldn't be loaded, autoloading
+ # is an internal mechanism that should not leak.
+ raise NameError, "Couldn't find #{mod_name}, expected it to be defined in helpers/#{file_name}.rb"
+ end
when Module
arg
else