[Rails] #expire_fragment in models...any clean solutions?

Derek Haynes derek.haynes at highgroove.com
Thu Aug 24 21:56:51 GMT 2006


I've seen a couple of workarounds on the mailing list related to
expiring cached fragments inside of models, but nothing too clean.
Anybody have any suggestions for handling this at the model-level? I
have an application is updated outside of the Rails controllers, so I
can't use a Sweeper.

The 2 methods I've seen:

a. Use a callback to generate an HTTP post on a controller action that
expires a fragment. While a little convoluted, it actually doesn't
look terribly bad, but the coupling between the controller and the
model isn't desired.

b. A home-baked solution to delete the fragments...however, there's a
lack of solid code snippets for this method.

Any other ideas?

Cheers,

Derek

-- 
Derek Haynes
Highgroove Studios - http://www.highgroove.com
San Mateo, CA | Atlanta, GA
Keeping it Simple.
650.276.0908

Slingshot - Ruby on Rails Business Hosting
http://www.slingshothosting.com


More information about the Rails mailing list