Expire_fragment Strange behavior

I’m following railscasts tutorial on fragment caching, everything works
great except for the sweepers. When i put expire_fragment(%r{.*})
directly in my controller, i can expire my fragments with wonderful
ease. Yet when i write a nice little sweeper like this code block,
nothing gets expired (the puts have been added in for troubleshooting):

class PhraseSweeper < ActionController::Caching::Sweeper
observe Phrase

def after_update(phrase)

def expire_cache(phrase)
puts "=====This Is Activated Via expire_cache(phrase) "
puts expire_fragment(%r{.}).class

I put this put it in apps/sweepers, and initialize the folder under
environment.rb. When i update my phrase model I get this in my console:

=====This Is Activated Via expire_cache(phrase)
=====This Is Activated Via expire_cache(phrase)

Yet when i have the expire_fragment called via my controller i get this
in the console:

======This is called via the controller======

So, my sweeper folder is getting initialized, and the code is running on
update, but for some reason the puts are called twice, and the
expire_fragment doesn’t work at all. Rails 2.1.0 Ruby 1.8.6. Any

Sorry, wrong forum…re-posted under ‘rails’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs