My Cache Sweeper was never invoked

Hi there!

I have done the following:

  1. added the following in config/enivronment.rb:
    config.load_paths += %W( #{RAILS_ROOT}/app/cachers )

  2. in app/cachers I created profile_sweeper.rb:
    class ProfileSweeper < ActionController::Caching::Sweeper
    observe User

def after_save(record)
breakpoint
… do something …
end

def after_update(record)
breakpoint
end
end

  1. In my app/controllers/user_controller.rb I added the following:
    class UserController < ApplicationController
    cache_sweeper :profile_sweeper, :only=>[:edit]

However when I called the page /user/edit and saved my changes to the
database by a @user.save, the cache sweeper was never invoked…

Do anyone know what’s wrong with my code? I am wondering for a coupple
of hours and could not find any solution while Rails didn’t inform me
any error…

Thank for you kind attention!

Regards,
Vance

in case your doing a ‘cant see the forest from the trees’ like i always
do. Ill suggest some duh things:

have you turned on caching in yor envir…/development.rb file ?

have you got it working in just the models directory without the
loadpath change ?

Actually, you may be able to help, the reason for my visit to the forum
was to ask if cache sweepers are the replacement for the soon to be
depreciated observers. I noticed a depreciation note while testing my
app today… oberserves to be depreciated in 2.0.

Just wanted to check if cache sweepers are the replacement for this
created_by functionality?