public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Improve readability
jeremy (author)
Tue Jun 24 11:53:49 -0700 2008
commit  69e72af62261dd8971890711b51c6eef2c68bc71
tree    f80e7b0ae2d0f22ef345ad38eac2f1e3b7c34179
parent  f6520b7dc7e460c62ba36dc761e39480bf77fe83
...
61
62
63
64
65
66
67
68
69
 
 
 
 
 
 
 
 
 
 
70
71
72
73
74
75
76
...
61
62
63
 
 
 
 
 
 
64
65
66
67
68
69
70
71
72
73
74
 
75
 
76
77
78
0
@@ -61,16 +61,18 @@ module ActionController #:nodoc:
0
       end
0
 
0
       def fragment_for(block, name = {}, options = nil) #:nodoc:
0
- unless perform_caching then block.call; return end
0
-
0
- buffer = yield
0
-
0
- if cache = read_fragment(name, options)
0
- buffer.concat(cache)
0
+ if perform_caching
0
+ buffer = yield
0
+
0
+ if cache = read_fragment(name, options)
0
+ buffer.concat(cache)
0
+ else
0
+ pos = buffer.length
0
+ block.call
0
+ write_fragment(name, buffer[pos..-1], options)
0
+ end
0
         else
0
- pos = buffer.length
0
           block.call
0
- write_fragment(name, buffer[pos..-1], options)
0
         end
0
       end
0
 
...
53
54
55
56
 
 
 
57
58
59
...
53
54
55
 
56
57
58
59
60
61
0
@@ -53,7 +53,9 @@ module ActionView
0
       end
0
 
0
       def cache_fragment(block, name = {}, options = nil) #:nodoc:
0
- @view.fragment_for(block, name, options) { @view.response.template.output_buffer ||= '' }
0
+ @view.fragment_for(block, name, options) do
0
+ @view.response.template.output_buffer
0
+ end
0
       end
0
     end
0
   end

Comments