diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 21d9c698312906f707a1da7d26cf77baab7da309..cc5544241e2a856f84a99921d6f7103a855843cc 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -247,10 +247,10 @@ def self.append_features(base) #:nodoc: end # Called by CacheHelper#cache - def cache_erb_fragment(name = {}, options = {}, &block) + def cache_erb_fragment(block, name = {}, options = {}) unless perform_caching then block.call; return end - buffer = eval("_erbout", block) + buffer = eval("_erbout", block.binding) if cache = read_fragment(name, options) buffer.concat(cache) diff --git a/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb b/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb index b494674c9155cac365c798eada84feb94824db22..706654e52bf47d02f48a98e05a7d8877af8da268 100644 --- a/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb +++ b/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb @@ -16,11 +16,11 @@ def initialize_query() end private - def multipart_form_boundary - multipart_form_boundary_re = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n # " ruby-mode - + MULTIPART_FORM_BOUNDARY_RE = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n + + def multipart_form_boundary if env_table['REQUEST_METHOD'] == 'POST' - multipart_form_boundary_re.match(env_table['CONTENT_TYPE']).to_a.pop + MULTIPART_FORM_BOUNDARY_RE.match(env_table['CONTENT_TYPE']).to_a.pop end end diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index 9353e5a6942ebd307254ebc9b9717d9039e0c890..de2707ac755ae394f93c6ca4287684c621f2ae14 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -2,8 +2,8 @@ module ActionView module Helpers # See ActionController::Caching::Fragments for usage instructions. module CacheHelper - def cache(name = {}) - @controller.cache_erb_fragment(binding, name) { yield } + def cache(name = {}, &block) + @controller.cache_erb_fragment(block, name) end end end