diff options
author | José Valim <jose.valim@gmail.com> | 2010-09-29 11:18:31 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-29 11:18:31 +0200 |
commit | 14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5 (patch) | |
tree | 7bd869d61e99d58dbd374a5d2ce344139a784551 /actionpack/lib/abstract_controller | |
parent | 0bbf9029e8089356aed0e3be2f859d56951a89cf (diff) | |
download | rails-14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5.tar.gz rails-14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5.tar.bz2 rails-14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5.zip |
Avoid (@_var ||= nil) pattern by using initialize methods and ensuring everyone calls super as expected.
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r-- | actionpack/lib/abstract_controller/layouts.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/abstract_controller/url_for.rb | 1 |
3 files changed, 2 insertions, 5 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index bbc9739f14..5c853c3034 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -345,11 +345,9 @@ module AbstractController # * <tt>template</tt> - The template object for the default layout (or nil) def _default_layout(require_layout = false) begin - @_layout ||= nil layout_name = _layout if action_has_layout? rescue NameError => e - raise NoMethodError, - "You specified #{@_layout.inspect} as the layout, but no such method was found" + raise e.class, "Coult not render layout: #{e.message}" end if require_layout && action_has_layout? && !layout_name diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index cc6a7f4047..5d9b35d297 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -66,7 +66,7 @@ module AbstractController attr_writer :view_context_class def view_context_class - (@view_context_class ||= nil) || self.class.view_context_class + @view_context_class || self.class.view_context_class end def initialize(*) diff --git a/actionpack/lib/abstract_controller/url_for.rb b/actionpack/lib/abstract_controller/url_for.rb index 2e9de22ecd..e5d5bef6b4 100644 --- a/actionpack/lib/abstract_controller/url_for.rb +++ b/actionpack/lib/abstract_controller/url_for.rb @@ -1,7 +1,6 @@ module AbstractController module UrlFor extend ActiveSupport::Concern - include ActionDispatch::Routing::UrlFor def _routes |