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
3. 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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---