2012-12-29 22:46:36 -08:00
|
|
|
module FragmentExpiration
|
|
|
|
include FragmentLocalization
|
|
|
|
|
|
|
|
delegate :expire_fragment, :to => :controller
|
|
|
|
|
|
|
|
def expire_fragment_in_all_locales(key)
|
2013-12-08 21:44:25 -08:00
|
|
|
I18n.usable_locales.each do |locale|
|
2012-12-29 22:46:36 -08:00
|
|
|
localized_key = localize_fragment_key(key, locale)
|
|
|
|
expire_fragment(localized_key)
|
|
|
|
end
|
|
|
|
end
|
2013-06-27 00:00:37 -07:00
|
|
|
|
|
|
|
def expire_key_in_all_locales(key)
|
2013-12-08 21:44:25 -08:00
|
|
|
I18n.usable_locales.each do |locale|
|
2013-06-27 00:00:37 -07:00
|
|
|
localized_key = localize_fragment_key(key, locale)
|
|
|
|
Rails.cache.delete(localized_key)
|
|
|
|
end
|
|
|
|
end
|
2012-12-29 22:46:36 -08:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def controller
|
|
|
|
@controller ||= ActionController::Base.new
|
|
|
|
end
|
|
|
|
end
|