1
require 'active_record'
3
module ActionController #:nodoc:
5
class Sweeper < ActiveRecord::Observer #:nodoc:
6
attr_accessor :controller
9
self.controller = controller
10
callback(:before) if controller.perform_caching
14
callback(:after) if controller.perform_caching
15
# Clean up, so that the controller can be collected after this request
20
# gets the action cache path for the given options.
21
def action_path_for(options)
22
ActionController::Caching::Actions::ActionCachePath.path_for(controller, options)
25
# Retrieve instance variables set in the controller.
27
controller.instance_variable_get("@#{key}")
32
controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"
33
action_callback_method_name = "#{controller_callback_method_name}_#{controller.action_name}"
35
__send__(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
36
__send__(action_callback_method_name) if respond_to?(action_callback_method_name, true)
39
def method_missing(method, *arguments, &block)
40
return if @controller.nil?
41
@controller.__send__(method, *arguments, &block)