diff options
Diffstat (limited to 'actionpack/lib/action_view/renderable.rb')
-rw-r--r-- | actionpack/lib/action_view/renderable.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/renderable.rb b/actionpack/lib/action_view/renderable.rb index d960335220..0134bc988f 100644 --- a/actionpack/lib/action_view/renderable.rb +++ b/actionpack/lib/action_view/renderable.rb @@ -1,8 +1,7 @@ module ActionView - module Renderable - # NOTE: The template that this mixin is beening include into is frozen - # So you can not set or modify any instance variables - + # NOTE: The template that this mixin is being included into is frozen + # so you cannot set or modify any instance variables + module Renderable #:nodoc: extend ActiveSupport::Memoizable def self.included(base) @@ -33,10 +32,11 @@ module ActionView view.send(:_set_controller_content_type, mime_type) if respond_to?(:mime_type) view.send(method_name(local_assigns), local_assigns) do |*names| - if proc = view.instance_variable_get("@_proc_for_layout") + ivar = :@_proc_for_layout + if view.instance_variable_defined?(ivar) and proc = view.instance_variable_get(ivar) view.capture(*names, &proc) - else - view.instance_variable_get("@content_for_#{names.first || 'layout'}") + elsif view.instance_variable_defined?(ivar = :"@content_for_#{names.first || :layout}") + view.instance_variable_get(ivar) end end end @@ -72,12 +72,9 @@ module ActionView end_src begin - logger = defined?(ActionController) && Base.logger - logger.debug "Compiling template #{render_symbol}" if logger - ActionView::Base::CompiledTemplates.module_eval(source, filename, 0) rescue Exception => e # errors from template code - if logger + if logger = defined?(ActionController) && Base.logger logger.debug "ERROR: compiling #{render_symbol} RAISED #{e}" logger.debug "Function body: #{source}" logger.debug "Backtrace: #{e.backtrace.join("\n")}" |