mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removed config.action_view.cache_template_loading, use config.cache_classes instead
This commit is contained in:
parent
5cc3ea6969
commit
83e29b9773
8 changed files with 20 additions and 11 deletions
|
@ -1,5 +1,7 @@
|
|||
*Edge*
|
||||
|
||||
* Removed config.action_view.cache_template_loading, use config.cache_classes instead [Josh Peek]
|
||||
|
||||
* Get buffer for fragment cache from template's @output_buffer [Josh Peek]
|
||||
|
||||
* Set config.action_view.warn_cache_misses = true to receive a warning if you perform an action that results in an expensive disk operation that could be cached [Josh Peek]
|
||||
|
|
|
@ -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. " <<
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,7 +22,6 @@ ActiveSupport::Deprecation.debug = true
|
|||
ActionController::Base.logger = nil
|
||||
ActionController::Routing::Routes.reload rescue nil
|
||||
|
||||
ActionView::Base.cache_template_loading = true
|
||||
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
ActionController::Base.view_paths = FIXTURE_LOAD_PATH
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ config.cache_classes = true
|
|||
# Full error reports are disabled and caching is turned on
|
||||
config.action_controller.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_view.cache_template_loading = true
|
||||
|
||||
# Use a different cache store in production
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
|
|
@ -414,6 +414,7 @@ Run `rake gems:install` to install the missing gems.
|
|||
# paths have already been set, it is not changed, otherwise it is
|
||||
# set to use Configuration#view_path.
|
||||
def initialize_framework_views
|
||||
ActionView::PathSet::Path.eager_load_templates! if configuration.cache_classes
|
||||
ActionMailer::Base.template_root ||= configuration.view_path if configuration.frameworks.include?(:action_mailer)
|
||||
ActionController::Base.view_paths = [configuration.view_path] if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.empty?
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'action_controller/performance_test'
|
||||
|
||||
ActionController::Base.perform_caching = true
|
||||
ActionView::Base.cache_template_loading = true
|
||||
ActiveSupport::Dependencies.mechanism = :require
|
||||
Rails.logger.level = ActiveSupport::BufferedLogger::INFO
|
||||
|
|
Loading…
Reference in a new issue