Changeset 5289
- Timestamp:
- 10/12/06 23:29:04 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/caching.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/caching_test.rb (moved) (moved from trunk/actionpack/test/controller/action_caching_test.rb) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r5288 r5289 1 1 *SVN* 2 3 * Make page caching respect the format of the resource that is being requested even if the current route is the default route so that, e.g. posts.rss is not transformed by url_for to '/' and subsequently cached as '/index.html' when it should be cached as '/posts.rss'. [Marcel Molina Jr.] 2 4 3 5 * Use String#chars in TextHelper::excerpt. Closes #6386 [Manfred Stienstra] trunk/actionpack/lib/action_controller/caching.rb
r5248 r5289 119 119 if options[:action].is_a?(Array) 120 120 options[:action].dup.each do |action| 121 self.class.expire_page(url_for(options.merge( { :only_path => true, :skip_relative_url_root => true, :action => action })))121 self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :action => action))) 122 122 end 123 123 else 124 self.class.expire_page(url_for(options.merge( { :only_path => true, :skip_relative_url_root => true })))124 self.class.expire_page(url_for(options.merge(:only_path => true, :skip_relative_url_root => true))) 125 125 end 126 126 end … … 131 131 def cache_page(content = nil, options = {}) 132 132 return unless perform_caching && caching_allowed 133 self.class.cache_page(content || response.body, url_for(options.merge( { :only_path => true, :skip_relative_url_root => true })))133 self.class.cache_page(content || response.body, url_for(options.merge(:only_path => true, :skip_relative_url_root => true, :format => params[:format]))) 134 134 end 135 135 trunk/actionpack/test/controller/caching_test.rb
r5248 r5289 7 7 ActionController::Base.perform_caching = true 8 8 ActionController::Base.fragment_cache_store = :file_store, FILE_STORE_PATH 9 10 class PageCachingTest < Test::Unit::TestCase 11 def setup 12 ActionController::Routing::Routes.draw do |map| 13 map.main '', :controller => 'posts' 14 map.resources :posts 15 map.connect ':controller/:action/:id' 16 end 17 18 @request = ActionController::TestRequest.new 19 @params = {:controller => 'posts', :action => 'index', :only_path => true, :skip_relative_url_root => true} 20 @rewriter = ActionController::UrlRewriter.new(@request, @params) 21 end 22 23 def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_default_route 24 @params[:format] = 'rss' 25 assert_equal '/posts.rss', @rewriter.rewrite(@params) 26 @params[:format] = nil 27 assert_equal '/', @rewriter.rewrite(@params) 28 end 29 end 9 30 10 31 class ActionCachingTestController < ActionController::Base