diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2009-02-09 14:20:30 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-02-09 14:20:30 -0600 |
commit | 893e9eb99504705419ad6edac14d00e71cef5f12 (patch) | |
tree | 17a2c15b63335beb97ecfea5ca6ca5a776639fa5 /actionpack/lib/action_view/paths.rb | |
parent | 5120429c3138d46490a1c4a611ebd93410f4f885 (diff) | |
download | rails-893e9eb99504705419ad6edac14d00e71cef5f12.tar.gz rails-893e9eb99504705419ad6edac14d00e71cef5f12.tar.bz2 rails-893e9eb99504705419ad6edac14d00e71cef5f12.zip |
Improve view rendering performance in development mode and reinstate template recompiling in production [#1909 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 17 |
1 files changed, 8 insertions, 9 deletions
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 |