Module: ActionController::Caching::Sweeping::ClassMethods
- Defined in:
- lib/action_controller/caching/sweeping.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#cache_sweeper(*sweepers) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/action_controller/caching/sweeping.rb', line 38 def cache_sweeper(*sweepers) configuration = sweepers. sweepers.each do |sweeper| ActiveRecord::Base.observers << sweeper if defined?(ActiveRecord) and defined?(ActiveRecord::Base) sweeper_instance = (sweeper.is_a?(Symbol) ? Object.const_get(sweeper.to_s.classify) : sweeper).instance if sweeper_instance.is_a?(Sweeper) around_filter(sweeper_instance, :only => configuration[:only]) else after_filter(sweeper_instance, :only => configuration[:only]) end end end |