Skip to content
This repository
Browse code

Fixed more caching and routing love

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@728 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 1677404893bb7e58c8e7529299840c938a868cbb 1 parent 48a44b7
David Heinemeier Hansson authored February 21, 2005
10  actionpack/lib/action_controller/caching.rb
@@ -67,7 +67,7 @@ module ClassMethods
67 67
         def expire_page(path)
68 68
           return unless perform_caching
69 69
           File.delete(page_cache_path(path)) if File.exists?(page_cache_path(path))
70  
-          logger.info "Expired page: #{path}" unless logger.nil?
  70
+          logger.info "Expired page: #{page_cache_file(path)}" unless logger.nil?
71 71
         end
72 72
         
73 73
         # Manually cache the +content+ in the key determined by +path+. Example:
@@ -76,7 +76,7 @@ def cache_page(content, path)
76 76
           return unless perform_caching
77 77
           FileUtils.makedirs(File.dirname(page_cache_path(path)))
78 78
           File.open(page_cache_path(path), "w+") { |f| f.write(content) }
79  
-          logger.info "Cached page: #{path}" unless logger.nil?
  79
+          logger.info "Cached page: #{page_cache_file(path)}" unless logger.nil?
80 80
         end
81 81
 
82 82
         # Caches the +actions+ using the page-caching approach that'll store the cache in a path within the page_cache_directory that
@@ -89,8 +89,12 @@ def caches_page(*actions)
89 89
         end
90 90
         
91 91
         private
  92
+          def page_cache_file(path)
  93
+            (path.empty? ? "/index" : path) + ".html"
  94
+          end
  95
+        
92 96
           def page_cache_path(path)
93  
-            page_cache_directory + (path.empty? ? "/index" : path) + ".html"
  97
+            page_cache_directory + page_cache_file(path)
94 98
           end
95 99
       end
96 100
 
3  actionpack/lib/action_controller/routing.rb
@@ -214,11 +214,10 @@ def generate(options, request)
214 214
 
215 215
         options = options.symbolize_keys
216 216
         defaults = request.path_parameters.symbolize_keys
  217
+        options = defaults if options.empty? # Get back the current url if no options was passed
217 218
         expand_controller_path!(options, defaults)
218 219
         defaults.delete_if {|k, v| options.key?(k) && options[k].nil?} # Remove defaults that have been manually cleared using :name => nil
219 220
 
220  
-        options = defaults if options.empty? # Get back the current url if no options was passed
221  
-
222 221
         failures = []
223 222
         selected = nil
224 223
         self.each do |route|

0 notes on commit 1677404

Please sign in to comment.
Something went wrong with that request. Please try again.