rails/rails — Issue #3729: uninitialized constant ActionController::Caching::Sweeper
Author: jesseclark
Created: 2011-11-23 04:44:23+00:00
State: open

I'm using rails 3.1.3 and ruby 1.9.2.

Following the Rails Caching Guide I have created a sweeper to clear memcached when related objects get modified.

```ruby
class MedicalProfileSweeper < ActionController::Caching::Sweeper
observe MedicalProfile, User, Study

def expire_cached_content(mp)
Rails.cache.delete("matches_for_#{mp.user.id}")
end

alias_method :after_save, :expire_cached_content
alias_method :after_destroy, :expire_cached_content

end
```

When I try to start the server the app pukes with this error:
/app/sweepers/medical_profile_sweeper.rb:1:in `': uninitialized constant ActionController::Caching::Sweeper (NameError)

I have added app/sweepers to the autoload_paths.
I am not using ActiveRecord in this app and this is how I am requiring the rails libs that I am using:

```ruby
require "active_resource/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"
```