diff options
author | Santiago Pastorino and Carl Lerche <santiago+carl@wyeworks.com> | 2010-04-15 16:58:54 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-04-15 18:25:08 -0300 |
commit | 0ea434e2f4083368fe9657aae9ceb5c484336f14 (patch) | |
tree | 0b665d482b792621fd8c7675b053d763fa6cc47c /actionpack/lib | |
parent | 005c2bac46051581e5af826a183c66185022772d (diff) | |
download | rails-0ea434e2f4083368fe9657aae9ceb5c484336f14.tar.gz rails-0ea434e2f4083368fe9657aae9ceb5c484336f14.tar.bz2 rails-0ea434e2f4083368fe9657aae9ceb5c484336f14.zip |
Make perform_caching work again, with the tests passing and backward compatible
Diffstat (limited to 'actionpack/lib')
4 files changed, 11 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 3489d94ec9..b3fa129929 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -52,7 +52,7 @@ module ActionController #:nodoc: private def cache_configured? - config.perform_caching && cache_store + perform_caching && cache_store end end diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb index 801b9918c1..20df3a1a69 100644 --- a/actionpack/lib/action_controller/caching/pages.rb +++ b/actionpack/lib/action_controller/caching/pages.rb @@ -44,8 +44,8 @@ module ActionController #:nodoc: # For Rails, this directory has already been set to Rails.public_path (which is usually set to <tt>Rails.root + "/public"</tt>). Changing # this setting can be useful to avoid naming conflicts with files in <tt>public/</tt>, but doing so will likely require configuring your # web server to look in the new location for cached files. - @@page_cache_directory = '' - cattr_accessor :page_cache_directory + singleton_class.delegate :page_cache_directory, :page_cache_directory=, :to => :config + self.page_cache_directory = '' ## # :singleton-method: @@ -53,15 +53,15 @@ module ActionController #:nodoc: # order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is <tt>.html</tt>. # If you want something else, like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension. In cases where a request already has an # extension, such as <tt>.xml</tt> or <tt>.rss</tt>, page caching will not add an extension. This allows it to work well with RESTful apps. - @@page_cache_extension = '.html' - cattr_accessor :page_cache_extension + singleton_class.delegate :page_cache_extension, :page_cache_extension=, :to => :config + self.page_cache_extension = '.html' end module ClassMethods # Expires the page that was cached with the +path+ as a key. Example: # expire_page "/lists/show" def expire_page(path) - return unless config.perform_caching + return unless perform_caching path = page_cache_path(path) instrument_page_cache :expire_page, path do @@ -72,7 +72,7 @@ module ActionController #:nodoc: # Manually cache the +content+ in the key determined by +path+. Example: # cache_page "I'm the cached content", "/lists/show" def cache_page(content, path) - return unless config.perform_caching + return unless perform_caching path = page_cache_path(path) instrument_page_cache :write_page, path do @@ -92,7 +92,7 @@ module ActionController #:nodoc: # # cache the index action except for JSON requests # caches_page :index, :if => Proc.new { |c| !c.request.format.json? } def caches_page(*actions) - return unless config.perform_caching + return unless perform_caching options = actions.extract_options! after_filter({:only => actions}.merge(options)) { |c| c.cache_page } end @@ -116,7 +116,7 @@ module ActionController #:nodoc: # Expires the page that was cached with the +options+ as a key. Example: # expire_page :controller => "lists", :action => "show" def expire_page(options = {}) - return unless config.perform_caching + return unless self.class.perform_caching if options.is_a?(Hash) if options[:action].is_a?(Array) @@ -135,7 +135,7 @@ module ActionController #:nodoc: # If no options are provided, the requested url is used. Example: # cache_page "I'm the cached content", :controller => "lists", :action => "show" def cache_page(content = nil, options = nil) - return unless config.perform_caching && caching_allowed + return unless self.class.perform_caching && caching_allowed path = case options when Hash diff --git a/actionpack/lib/action_controller/deprecated/base.rb b/actionpack/lib/action_controller/deprecated/base.rb index 510c363aa6..6bd2288f19 100644 --- a/actionpack/lib/action_controller/deprecated/base.rb +++ b/actionpack/lib/action_controller/deprecated/base.rb @@ -157,7 +157,6 @@ module ActionController deprecated_config_accessor :page_cache_extension deprecated_config_accessor :protected_instance_variables deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it" - deprecated_config_accessor :perform_caching deprecated_config_accessor :stylesheets_dir delegate :consider_all_requests_local, :consider_all_requests_local=, diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index 98ac43c33a..9c6fc752e5 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -39,7 +39,7 @@ module ActionView private # TODO: Create an object that has caching read/write on it def fragment_for(name = {}, options = nil, &block) #:nodoc: - if controller.config.perform_caching + if controller.class.perform_caching if controller.fragment_exist?(name, options) controller.read_fragment(name, options) else |