diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-15 22:51:16 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-15 22:58:42 -0500 |
commit | 83e29b9773ac113ceacb1e36c2f333d692de2573 (patch) | |
tree | 5cc5a8d9c1c646550df1741da9f78783e22038fe /actionpack/lib/action_view | |
parent | 5cc3ea6969f047a782fa8ac44530baeef597edb3 (diff) | |
download | rails-83e29b9773ac113ceacb1e36c2f333d692de2573.tar.gz rails-83e29b9773ac113ceacb1e36c2f333d692de2573.tar.bz2 rails-83e29b9773ac113ceacb1e36c2f333d692de2573.zip |
Removed config.action_view.cache_template_loading, use config.cache_classes instead
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 16 | ||||
-rw-r--r-- | actionpack/lib/action_view/renderable.rb | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 04e8d3a358..0ea96f045e 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -171,9 +171,10 @@ module ActionView #:nodoc: delegate :erb_trim_mode=, :to => 'ActionView::TemplateHandlers::ERB' end - # Specify whether templates should be cached. Otherwise the file we be read everytime it is accessed. - @@cache_template_loading = false - cattr_accessor :cache_template_loading + def self.cache_template_loading=(*args) + ActiveSupport::Deprecation.warn("config.action_view.cache_template_loading option has been deprecated and has no affect. " << + "Please remove it from your config files.", caller) + end def self.cache_template_extensions=(*args) ActiveSupport::Deprecation.warn("config.action_view.cache_template_extensions option has been deprecated and has no affect. " << diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index b0ab7d0c67..c7a5df762f 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -16,6 +16,14 @@ module ActionView #:nodoc: end class Path #:nodoc: + def self.eager_load_templates! + @eager_load_templates = true + end + + def self.eager_load_templates? + @eager_load_templates || false + end + attr_reader :path, :paths delegate :to_s, :to_str, :inspect, :to => :path @@ -37,6 +45,9 @@ module ActionView #:nodoc: @paths = {} templates_in_path do |template| + # Eager load memoized methods and freeze cached template + template.freeze if self.class.eager_load_templates? + @paths[template.path] = template @paths[template.path_without_extension] ||= template end @@ -48,10 +59,7 @@ module ActionView #:nodoc: def templates_in_path (Dir.glob("#{@path}/**/*/**") | Dir.glob("#{@path}/**")).each do |file| unless File.directory?(file) - template = Template.new(file.split("#{self}/").last, self) - # Eager load memoized methods and freeze cached template - template.freeze if Base.cache_template_loading - yield template + yield Template.new(file.split("#{self}/").last, self) end end end diff --git a/actionpack/lib/action_view/renderable.rb b/actionpack/lib/action_view/renderable.rb index f66356c939..badb2b171c 100644 --- a/actionpack/lib/action_view/renderable.rb +++ b/actionpack/lib/action_view/renderable.rb @@ -72,7 +72,7 @@ module ActionView # if local_assigns has a new key, which isn't supported by the compiled code yet. def recompile?(symbol) meth = Base::CompiledTemplates.instance_method(template.method) rescue nil - !(meth && Base.cache_template_loading) + !(meth && frozen?) end end end |