diff options
author | Piotr Niełacny <piotr.nielacny@gmail.com> | 2013-05-16 15:37:19 +0200 |
---|---|---|
committer | LTe <piotr.nielacny@gmail.com> | 2013-07-10 11:26:43 +0200 |
commit | e0438b1c071d8dc2c7fc87075485d4ac01f4eb07 (patch) | |
tree | 1e32dee1c3d40652cca3734c0ddfe89defac045d /actionpack/lib/abstract_controller | |
parent | cd0d5902dd237794049cac1ee89ab0c07a16a851 (diff) | |
download | rails-e0438b1c071d8dc2c7fc87075485d4ac01f4eb07.tar.gz rails-e0438b1c071d8dc2c7fc87075485d4ac01f4eb07.tar.bz2 rails-e0438b1c071d8dc2c7fc87075485d4ac01f4eb07.zip |
Show real LoadError on helpers require
When helper try to require missing file rails will throw exception about
missing helper.
# app/helpers/my_helper.rb
require 'missing'
module MyHelper
end
And when we try do load helper
class ApplicationController
helper :my
end
Rails will throw exception. This is wrong because there is a helper
file.
Missing helper file helpers/my_helper.rb
Now when helper try to require non-existed file rails will throw proper
exception.
No such file to load -- missing
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r-- | actionpack/lib/abstract_controller/helpers.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index 5ae8c6c3b0..a928205963 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -150,7 +150,12 @@ module AbstractController @error = error @path = "helpers/#{path}.rb" set_backtrace error.backtrace - super("Missing helper file helpers/%s.rb" % path) + + if error.path =~ /^#{path}(\.rb)?$/ + super("Missing helper file helpers/%s.rb" % path) + else + raise error + end end end |