Commit cc29a49720253d4703e67b0b023a74d3a3c6e14f
Committed by
Antonio Terceiro
1 parent
f6f306c5
Exists in
master
and in
14 other branches
Fix rails 4 caching expiration
Signed-off-by: Carlos Purificacao <carloseugenio@gmail.com> Acked-by: Antonio Terceiro <terceiro@colivre.coop.br>
Showing
3 changed files
with
6 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1241,7 +1241,7 @@ module ApplicationHelper | @@ -1241,7 +1241,7 @@ module ApplicationHelper | ||
1241 | end | 1241 | end |
1242 | 1242 | ||
1243 | def cache_timeout(key, timeout, &block) | 1243 | def cache_timeout(key, timeout, &block) |
1244 | - cache(key, { :expires_in => timeout }, &block) | 1244 | + cache(key, { :expires_in => timeout, :skip_digest => true }, &block) |
1245 | end | 1245 | end |
1246 | 1246 | ||
1247 | def is_cache_expired?(key) | 1247 | def is_cache_expired?(key) |
app/models/block.rb
@@ -235,7 +235,7 @@ class Block < ActiveRecord::Base | @@ -235,7 +235,7 @@ class Block < ActiveRecord::Base | ||
235 | 235 | ||
236 | alias :active_record_cache_key :cache_key | 236 | alias :active_record_cache_key :cache_key |
237 | def cache_key(language='en', user=nil) | 237 | def cache_key(language='en', user=nil) |
238 | - active_record_cache_key+'-'+language | 238 | + active_record_cache_key + '-' + language |
239 | end | 239 | end |
240 | 240 | ||
241 | def timeout | 241 | def timeout |
plugins/event/lib/event_plugin/event_block.rb
@@ -81,4 +81,8 @@ class EventPlugin::EventBlock < Block | @@ -81,4 +81,8 @@ class EventPlugin::EventBlock < Block | ||
81 | content_tag(:span, date.year.to_s, :class => 'year') | 81 | content_tag(:span, date.year.to_s, :class => 'year') |
82 | end | 82 | end |
83 | 83 | ||
84 | + def self.expire_on | ||
85 | + { :profile => [:article], :environment => [:article] } | ||
86 | + end | ||
87 | + | ||
84 | end | 88 | end |