I want to make sure my sweeper is being called as appropriate so I tried adding something like this:
it "should clear the cache" do
@foo = Foo.new(@create_params)
Foo.should_receive(:new).with(@create_params).and_return(@foo)
FooSweeper.should_receive(:after_save).with(@foo)
post :create, @create_params
end
But I just ...
Hey guys,
This is my two model relationship.
team has_many groups
group belongs_to team
I have a sweeper that runs in my group model.
In my Team controller I have this in the after_create callback.
def after_create
self.groups.create(:name => DEFAULT_GROUP, :active => true, :description => "Parent group")
end
I am getting error...
I'm working on a Rails app, where I'm using page caching to store static html output. The caching works fine. I'm having trouble expiring the caches, though.
I believe my problem is, in part, because I'm not expiring the cache from my controller. All of the actions necessary for this are being handled within the model. This seems like i...
Hi there,
I've got a sweeper that's supposed to expire a few action caches. Even though the debugger stops immediately before the call to expire_action, it's not actually expiring the action. Any idea what could be going on?
Here are the relevant sweeper and controller.
#company_sweeper.rb (in 'models' directory)
class CompanySweeper ...
Hi
I want to expire a cached action and wondered how to generate the correct reference.
#controller
caches_action :index, :layout => false
#generates this fragment which works fine
views/0.0.0.0:3000/article/someid/posts
#sweeper
...
expire_action article_posts_path(:article_id => post.article)
# results in this
Expired fragment: view...
This is for Ruby 1.8.7 & Rails 3.0.1.
I have a model TeachingGroup, which belongs to current_user.current_term.
A Sweeper exists with:
class TeachingGroupSweeper < ActionController::Caching::Sweeper
observe TeachingGroup
def after_update(teaching_group)
expire_cache_for(teaching_group) # elsewhere, working
end
... # other ...