diff options
author | John F. Douthat <johndouthat@gmail.com> | 2009-04-21 13:35:54 -0500 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-30 16:43:01 -0700 |
commit | e59835bd0934a7458b71b13bf65786c8484905bd (patch) | |
tree | 67fdfd8c895bd2c1b2908e06b55b5a9b50b90ce8 /actionpack/lib | |
parent | 00d1a57e9f99a1b2439281cb741fd82ef47a5c55 (diff) | |
download | rails-e59835bd0934a7458b71b13bf65786c8484905bd.tar.gz rails-e59835bd0934a7458b71b13bf65786c8484905bd.tar.bz2 rails-e59835bd0934a7458b71b13bf65786c8484905bd.zip |
Fix action-cached exception responses.
Methods raising ActiveRecord::RecordNotFound were returning 404 on first request and 200 OK with blank body on subsequent requests.
[#2533 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/caching/actions.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index d95a346862..2b822b52c8 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -61,7 +61,9 @@ module ActionController #:nodoc: filter_options = { :only => actions, :if => options.delete(:if), :unless => options.delete(:unless) } cache_filter = ActionCacheFilter.new(:layout => options.delete(:layout), :cache_path => options.delete(:cache_path), :store_options => options) - around_filter(cache_filter, filter_options) + around_filter(filter_options) do |controller, action| + cache_filter.filter(controller, action) + end end end @@ -83,6 +85,12 @@ module ActionController #:nodoc: @options = options end + def filter(controller, action) + should_continue = before(controller) + action.call if should_continue + after(controller) + end + def before(controller) cache_path = ActionCachePath.new(controller, path_options_for(controller, @options.slice(:cache_path))) if cache = controller.read_fragment(cache_path.path, @options[:store_options]) |