Sha256: a8a762abad2e2c4f3119b8315b5dea63c4c98782fb015e0e01fa4388dd82ead0

Contents?: true

Size: 674 Bytes

Versions: 10

Compression:

Stored size: 674 Bytes

Contents

class EventSweeper < ActionController::Caching::Sweeper
  observe Event # This sweeper is going to keep an eye on the Event model

  # If our sweeper detects that an Event was created call this
  def after_create(event)
    expire_cache_for(event)
  end
  
  # If our sweeper detects that an Event was updated call this
  def after_update(event)
    expire_cache_for(event)
  end
  
  # If our sweeper detects that an Event was deleted call this
  def after_destroy(event)
    expire_cache_for(event)
  end
          
  private
  def expire_cache_for(record)
    # Expire the ical page
    expire_page(:controller => 'events', :action => 'ical', :format => 'ics')
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
community_engine-3.2.0 app/controllers/event_sweeper.rb
community_engine-3.0.0 app/controllers/event_sweeper.rb
community_engine-2.3.2 app/controllers/event_sweeper.rb
community_engine-2.3.1 app/controllers/event_sweeper.rb
community_engine-2.3.0 app/controllers/event_sweeper.rb
community_engine-2.1.0 app/controllers/event_sweeper.rb
community_engine-2.0.0 app/controllers/event_sweeper.rb
community_engine-2.0.0.beta3 app/controllers/event_sweeper.rb
community_engine-2.0.0.beta2 app/controllers/event_sweeper.rb
community_engine-2.0.0.beta1 app/controllers/event_sweeper.rb