Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # config/initializers/action_cache.rb
- module ActionController::Caching::Actions::ClassMethods
- # ex) continue filter chain
- #
- # caches_action :action_name, :continue => true
- #
- def caches_action(*actions)
- return unless cache_configured?
- options = actions.extract_options!
- around_filter(ActionController::Caching::Actions::ActionCacheFilter.new(:cache_path => options.delete(:cache_path), :continue => options.delete(:continue)), {:only => actions}.merge(options))
- end
- end
- class ActionController::Caching::Actions::ActionCacheFilter
- alias_method :before_origin, :before
- # ex) cancel action
- #
- # def action_name
- # if rendered_action_cache
- # @performed_render = true
- # return
- # end
- # ...
- # end
- #
- def before(controller)
- result = before_origin(controller)
- if result == false && @options[:continue]
- controller.instance_eval { @performed_render = false }
- return true
- end
- return result
- end
- end
Add Comment
Please, Sign In to add comment