diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-07-12 09:37:15 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-07-12 15:34:29 +0200 |
commit | 5bee14f3a46d6fc907044b739245c74edfb6012b (patch) | |
tree | c99856d2635d844a8fd6898a13a6ed265fd05db9 /actionpack/lib/abstract_controller | |
parent | d864dcd02a360cd15d4879b3fa8bcac1e3bec58a (diff) | |
download | rails-5bee14f3a46d6fc907044b739245c74edfb6012b.tar.gz rails-5bee14f3a46d6fc907044b739245c74edfb6012b.tar.bz2 rails-5bee14f3a46d6fc907044b739245c74edfb6012b.zip |
move `MissingHelperError` out of the `ClassMethods` module.
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r-- | actionpack/lib/abstract_controller/helpers.rb | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index a928205963..e77e4e01e9 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -12,7 +12,24 @@ module AbstractController self._helper_methods = Array.new end + class MissingHelperError < LoadError + def initialize(error, path) + @error = error + @path = "helpers/#{path}.rb" + set_backtrace error.backtrace + + if error.path =~ /^#{path}(\.rb)?$/ + super("Missing helper file helpers/%s.rb" % path) + else + raise error + end + end + end + module ClassMethods + MissingHelperError = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('AbstractController::Helpers::ClassMethods::MissingHelperError', + 'AbstractController::Helpers::MissingHelperError') + # When a class is inherited, wrap its helper module in a new module. # This ensures that the parent class's module can be changed # independently of the child class's. @@ -134,7 +151,7 @@ module AbstractController begin require_dependency(file_name) rescue LoadError => e - raise MissingHelperError.new(e, file_name) + raise AbstractController::Helpers::MissingHelperError.new(e, file_name) end file_name.camelize.constantize when Module @@ -145,20 +162,6 @@ module AbstractController end end - class MissingHelperError < LoadError - def initialize(error, path) - @error = error - @path = "helpers/#{path}.rb" - set_backtrace error.backtrace - - if error.path =~ /^#{path}(\.rb)?$/ - super("Missing helper file helpers/%s.rb" % path) - else - raise error - end - end - end - private # Makes all the (instance) methods in the helper module available to templates # rendered through this controller. |