[Git][noosfero/noosfero][master] Fix rails 4 caching expiration

Antonio Terceiro gitlab at mg.gitlab.com
Thu Feb 18 11:51:21 BRST 2016


Antonio Terceiro pushed to branch master at Noosfero / noosfero


Commits:
cc29a497 by Carlos Purificacao at 2016-02-18T11:43:13-02:00
Fix rails 4 caching expiration

Signed-off-by: Carlos Purificacao <carloseugenio at gmail.com>
Acked-by: Antonio Terceiro <terceiro at colivre.coop.br>

- - - - -


3 changed files:

- app/helpers/application_helper.rb
- app/models/block.rb
- plugins/event/lib/event_plugin/event_block.rb


Changes:

=====================================
app/helpers/application_helper.rb
=====================================
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1241,7 +1241,7 @@ module ApplicationHelper
   end
 
   def cache_timeout(key, timeout, &block)
-    cache(key, { :expires_in => timeout }, &block)
+    cache(key, { :expires_in => timeout, :skip_digest => true }, &block)
   end
 
   def is_cache_expired?(key)


=====================================
app/models/block.rb
=====================================
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -235,7 +235,7 @@ class Block < ActiveRecord::Base
 
   alias :active_record_cache_key :cache_key
   def cache_key(language='en', user=nil)
-    active_record_cache_key+'-'+language
+    active_record_cache_key + '-' + language
   end
 
   def timeout


=====================================
plugins/event/lib/event_plugin/event_block.rb
=====================================
--- a/plugins/event/lib/event_plugin/event_block.rb
+++ b/plugins/event/lib/event_plugin/event_block.rb
@@ -81,4 +81,8 @@ class EventPlugin::EventBlock < Block
     content_tag(:span, date.year.to_s, :class => 'year')
   end
 
+  def self.expire_on
+      { :profile => [:article], :environment => [:article] }
+  end
+
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/cc29a49720253d4703e67b0b023a74d3a3c6e14f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160218/270552a0/attachment.html>


More information about the Noosfero-dev mailing list