From 893e9eb99504705419ad6edac14d00e71cef5f12 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 9 Feb 2009 14:20:30 -0600 Subject: Improve view rendering performance in development mode and reinstate template recompiling in production [#1909 state:resolved] Signed-off-by: Joshua Peek --- actionpack/lib/action_view/paths.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'actionpack/lib/action_view/paths.rb') diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index b487bd1aa7..e14b21221c 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -2,11 +2,7 @@ module ActionView #:nodoc: class PathSet < Array #:nodoc: def self.type_cast(obj) if obj.is_a?(String) - if !Object.const_defined?(:Rails) || Rails.configuration.cache_classes - Template::EagerPath.new(obj) - else - Template::Path.new(obj) - end + Template::Path.new(obj) else obj end @@ -36,9 +32,8 @@ module ActionView #:nodoc: super(*objs.map { |obj| self.class.type_cast(obj) }) end - def find_template(original_template_path, format = nil) - return original_template_path if original_template_path.respond_to?(:render) - template_path = original_template_path.sub(/^\//, '') + def find_template(template_path, format = nil) + return template_path if template_path.respond_to?(:render) each do |load_path| if format && (template = load_path["#{template_path}.#{I18n.locale}.#{format}"]) @@ -57,7 +52,11 @@ module ActionView #:nodoc: end end - Template.new(original_template_path, self) + if File.exist?(template_path) + return Template.new(template_path, template_path[0] == 47 ? "" : ".") + end + + raise MissingTemplate.new(self, template_path, format) end end end -- cgit v1.2.3