diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-06-25 20:51:02 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-06-25 20:51:02 -0300 |
commit | f410c13bf8ec3a8fa3878d8acadb1f3d5a45032c (patch) | |
tree | 8bad915e21a7d0b3b32896a9803d0c56d2586cdf /actionview/lib/action_view/helpers | |
parent | f341acdae3abfa97247736dde01f5e79c61de7d2 (diff) | |
download | rails-f410c13bf8ec3a8fa3878d8acadb1f3d5a45032c.tar.gz rails-f410c13bf8ec3a8fa3878d8acadb1f3d5a45032c.tar.bz2 rails-f410c13bf8ec3a8fa3878d8acadb1f3d5a45032c.zip |
Refactor cache fragment handling with read/write methods
Diffstat (limited to 'actionview/lib/action_view/helpers')
-rw-r--r-- | actionview/lib/action_view/helpers/cache_helper.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index 2f2c8544ee..2a38e5c446 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -176,14 +176,14 @@ module ActionView # TODO: Create an object that has caching read/write on it def fragment_for(name = {}, options = nil, &block) #:nodoc: - if fragment = controller.read_fragment(name, options) - fragment - else - write_fragment_for(name, options, &block) - end + read_fragment_for(name, options) || write_fragment_for(name, options, &block) + end + + def read_fragment_for(name, options) #:nodoc: + controller.read_fragment(name, options) end - def write_fragment_for(name = {}, options = nil, &block) #:nodoc: + def write_fragment_for(name, options) #:nodoc: # VIEW TODO: Make #capture usable outside of ERB # This dance is needed because Builder can't use capture pos = output_buffer.length |