1
0
Fork 0
forked from OpenNeo/impress

expire item#as_json when updated

This commit is contained in:
Emi Matchu 2013-06-27 00:00:37 -07:00
parent 9e3cac82ec
commit bf697cef7b
2 changed files with 8 additions and 0 deletions

View file

@ -9,6 +9,13 @@ module FragmentExpiration
expire_fragment(localized_key)
end
end
def expire_key_in_all_locales(key)
I18n.available_locales.each do |locale|
localized_key = localize_fragment_key(key, locale)
Rails.cache.delete(localized_key)
end
end
private

View file

@ -22,6 +22,7 @@ class ItemObserver < ActionController::Caching::Sweeper
expire_fragment_in_all_locales("items/#{item.id}#item_link_partial")
expire_fragment_in_all_locales("items/#{item.id} header")
expire_fragment_in_all_locales("items/#{item.id} info")
expire_key_in_all_locales("items/#{item.id}#as_json")
end
def expire_newest_items