[Git][noosfero/noosfero][master] 3 commits: Adds skip_digest option to news caching

Tallys Martins gitlab at mg.gitlab.com
Wed Dec 28 11:07:34 BRST 2016


Tallys Martins pushed to branch master at Noosfero / noosfero


Commits:
f463a246 by Gabriel Silva at 2016-12-15T13:07:50+00:00
Adds skip_digest option to news caching

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>

- - - - -
4053bfcd by Gabriel Silva at 2016-12-15T13:07:50+00:00
Adds touch to Circles relations to enable cache expiring

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>

- - - - -
7f5868ea by Tallys Martins at 2016-12-28T13:07:28+00:00
Merge branch 'cache_fix' into 'master'

Fixes caching issues (highlighted news and followers)

See merge request !1069
- - - - -


4 changed files:

- app/models/circle.rb
- app/models/profile_follower.rb
- app/views/home/index.html.erb
- + db/migrate/20161213173859_add_timestamps_to_circles.rb


Changes:

=====================================
app/models/circle.rb
=====================================
--- a/app/models/circle.rb
+++ b/app/models/circle.rb
@@ -6,7 +6,7 @@ class Circle < ApplicationRecord
   _('Circle')
 
   has_many :profile_followers
-  belongs_to :person
+  belongs_to :person, touch: true
 
   attr_accessible :name, :person, :profile_type
 


=====================================
app/models/profile_follower.rb
=====================================
--- a/app/models/profile_follower.rb
+++ b/app/models/profile_follower.rb
@@ -4,8 +4,8 @@ class ProfileFollower < ApplicationRecord
 
   attr_accessible :profile, :circle
 
-  belongs_to :profile
-  belongs_to :circle
+  belongs_to :profile, touch: true
+  belongs_to :circle, touch: true
 
   has_one :person, through: :circle
   alias follower person


=====================================
app/views/home/index.html.erb
=====================================
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -1,6 +1,6 @@
 <% if @has_news %>
   <h1><%= _('News') %></h1>
-  <% cache @news_cache_key do %>
+  <% cache @news_cache_key, skip_digest: true do %>
     <div id='highlighted-news'>
       <% @highlighted_news.each_with_index do |highlighted, index| %>
         <div class='highlighted-news-item post-<%= index + 1 %>'>


=====================================
db/migrate/20161213173859_add_timestamps_to_circles.rb
=====================================
--- /dev/null
+++ b/db/migrate/20161213173859_add_timestamps_to_circles.rb
@@ -0,0 +1,11 @@
+class AddTimestampsToCircles < ActiveRecord::Migration
+  def up
+    add_column :circles, :created_at, :datetime
+    add_column :circles, :updated_at, :datetime
+  end
+
+  def down
+    remove_column :circles, :created_at
+    remove_column :circles, :updated_at
+  end
+end



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/99f4cb0ebe9cb2f2cd4030faa0f25e4bd94cd5f8...7f5868ea04f9fc01ce55bff5ce088480d4dc87ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20161228/62af0666/attachment-0001.html>


More information about the Noosfero-dev mailing list