diff options
Diffstat (limited to 'actionpack/lib/action_view/template.rb')
-rw-r--r-- | actionpack/lib/action_view/template.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index b4fdb49d3b..8abc1633ff 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -1,8 +1,7 @@ # encoding: utf-8 # This is so that templates compiled in this file are UTF-8 - -require 'set' -require "action_view/template/resolver" +require 'active_support/core_ext/array/wrap' +require 'active_support/core_ext/object/blank' module ActionView class Template @@ -24,19 +23,20 @@ module ActionView @identifier = identifier @handler = handler - @partial = details[:partial] @virtual_path = details[:virtual_path] @method_names = {} - format = details[:format] - format ||= handler.default_format.to_sym if handler.respond_to?(:default_format) - format ||= :html - @formats = [format.to_sym] + format = details[:format] || :html + @formats = Array.wrap(format).map(&:to_sym) end def render(view, locals, &block) - method_name = compile(locals, view) - view.send(method_name, locals, &block) + # Notice that we use a bang in this instrumentation because you don't want to + # consume this in production. This is only slow if it's being listened to. + ActiveSupport::Notifications.instrument("action_view.render_template!", :virtual_path => @virtual_path) do + method_name = compile(locals, view) + view.send(method_name, locals, &block) + end rescue Exception => e if e.is_a?(Template::Error) e.sub_template_of(self) @@ -58,10 +58,6 @@ module ActionView @counter_name ||= "#{variable_name}_counter".to_sym end - def partial? - @partial - end - def inspect if defined?(Rails.root) identifier.sub("#{Rails.root}/", '') |