I’ve run into a very strange problem and I can’t find any docs or any
code in rails core that can explain it.
The behavior is I have a sweeper which is a pure model sweeper so I
tried to use the
config.active_record.observers = [:my_sweeper]
to make it work. However it looks like if I don’t use the
cache_sweeper declaration in the controller, the sweeper gets invoked
but the call to expire_fragment simply does nothing. I found only one
very slight reference to this in a post online -
http://www.ruby-forum.com/topic/145163#643061. But this seems to be a
highly obscure problem. Any ideas?
I put a ‘puts’ call into the rails core expire_cache method and it
appears to never get there…so the logical explanation is that someone
has overridden expire_cache somewhere to make it silently do nothing
and I can’t seem to find where.
The whole point here is that I want my sweepers to act completely
transparently. I don’t want to declare them in every controller. They
should just observe models and act on them. But this behavior is
getting in the way.