Does anybody out there know rails internals?

i need to call a sweeper directly from a model to expire cache (the
sweeper is observing the model as usual). why is this not documented?
seems like something that everybody would need to know!!

come on people. this should be simple to do. the sweeper is observing
the model … how do I call the sweeper.after_save(record) method from
the model?

OK another approach: initialize a new sweeper and call from model.
another gotcha the new method is private for
ActionController::Caching::Sweeper. can anybody help with this?
there’s no documentation.

On 10/24/07, Gone S. [email protected]ain.invalid wrote:

OK another approach: initialize a new sweeper and call from model.
another gotcha the new method is private for
ActionController::Caching::Sweeper. can anybody help with this?
there’s no documentation.

I haven’t used sweepers, so I’m not much help; but it looks like this
is a singleton. So you would need SomeSweeper.instance to get at the
singleton object. Not sure what you would do with it though…

i did it!! from within the model call sweeper.instance.after_save(parm)
and you have expired the cache (assume after_save is the name of the
sweeper class method that is observing the model). you’re right it is a
singleton … thanks.

On 10/24/07, Bob S. [email protected] wrote:

singleton object. Not sure what you would do with it though…
Sweepers are half AR Observer and half controller filter. This means
they have to run from a controller. That’s where the methods for
expiring stuff lives. You’re probably better off using an Observer
then.


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

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