method
cache_sweeper
v2.3.8 -
Show latest stable
- Class:
ActionController::Caching::Sweeping::ClassMethods
cache_sweeper(*sweepers)public
No documentation available.
# File actionpack/lib/action_controller/caching/sweeping.rb, line 38
def cache_sweeper(*sweepers)
configuration = sweepers.extract_options!
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