diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-05-27 16:38:02 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-05-27 16:38:02 +0000 |
commit | d3b5db8919c61243c45ebd09254de20f4aa0cf1d (patch) | |
tree | 4da6169466bdd233002abce12c49d292f4dd0ab2 /actionpack/lib | |
parent | cd599aad715679355d16caf3585901034fca5a87 (diff) | |
download | rails-d3b5db8919c61243c45ebd09254de20f4aa0cf1d.tar.gz rails-d3b5db8919c61243c45ebd09254de20f4aa0cf1d.tar.bz2 rails-d3b5db8919c61243c45ebd09254de20f4aa0cf1d.zip |
Added custom path cache_page/expire_page parameters in addition to the options hashes [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6868 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index ddb36c5b8e..f77cf207f5 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -118,12 +118,17 @@ module ActionController #:nodoc: # expire_page :controller => "lists", :action => "show" def expire_page(options = {}) return unless perform_caching - if options[:action].is_a?(Array) - options[:action].dup.each do |action| - self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :action => action))) + + if options.is_a?(Hash) + if options[:action].is_a?(Array) + options[:action].dup.each do |action| + self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :action => action))) + end + else + self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true))) end else - self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true))) + self.class.expire_page(options) end end @@ -132,7 +137,14 @@ module ActionController #:nodoc: # cache_page "I'm the cached content", :controller => "lists", :action => "show" def cache_page(content = nil, options = {}) return unless perform_caching && caching_allowed - self.class.cache_page(content || response.body, url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :format => params[:format]))) + + if options.is_a?(Hash) + path = url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :format => params[:format])) + else + path = options + end + + self.class.cache_page(content || response.body, path) end private |