I code this on my controller:

caches_page :index
cache_sweeper :site_sweeper

https://github.com/leandromoreira/playground.activeadmin/blob/master/app/controllers/page_controller.rb

and this on my sweeper

class SiteSweeper < ActionController::Caching::Sweeper
observe Article, Category

def after_create(model)
expire_cache_for(model)
end

def after_update(model)
expire_cache_for(model)
end

def after_destroy(model)
expire_cache_for(model)
end

private
def expire_cache_for(model)
expire_page controller: 'page', action: 'index'
end
end

https://github.com/leandromoreira/playground.activeadmin/blob/master/app/sweepers/site_sweeper.rb

But I change my Article and the change do not expire the page, am I doing something wrong?


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/7wzAqhXPLkYJ.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 31, '12 at 10:14p
activeOct 31, '12 at 10:14p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Leandro Moreira: 1 post

People

Translate

site design / logo © 2022 Grokbase