public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
add assigned_section_sweeper so sections are swept when added to/removed 
from articles

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1490 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Aug 06 01:44:33 -0700 2006
commit  00bc39768e408eeca7d0a8a77156f1fe0a81f271
tree    7903f92fa3b06661b22adefd4a6c250ee19f12cc
parent  422f20385f2895f274e4d30a52cef1e71aa97531
...
9
10
11
 
 
12
13
...
9
10
11
12
13
14
15
0
@@ -9,4 +9,6 @@ class AssignedSectionSweeper < ActionController::Caching::Sweeper
0
       CachedPage.expire_pages(pages)
0
     end if pages.any?
0
   end
0
+
0
+ alias after_create after_destroy
0
 end
0
\ No newline at end of file
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 class Admin::ArticlesController < Admin::BaseController
0
   with_options :only => [:create, :update] do |c|
0
     c.before_filter :set_default_section_ids
0
- c.cache_sweeper :article_sweeper, :section_sweeper
0
+ c.cache_sweeper :article_sweeper, :section_sweeper, :assigned_section_sweeper
0
     cache_sweeper :comment_sweeper, :only => [:approve, :unapprove, :destroy_comment]
0
   end
0
 
...
80
81
82
83
 
84
85
86
...
80
81
82
 
83
84
85
86
0
@@ -80,7 +80,7 @@ class MephistoController < ApplicationController
0
     
0
       self.cached_references << @section << @article
0
       Mephisto::Liquid::CommentForm.article = @article
0
- render_liquid_template_for(template_type, 'section' => @section.to_liquid,
0
+ render_liquid_template_for(template_type, 'section' => @section.to_liquid,
0
                                                 'pages' => @section.articles.collect(&:to_liquid),
0
                                                 'article' => @article.to_liquid(:single),
0
                                                 'article_sections' => @article.sections.collect(&:to_liquid))
...
167
168
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
171
172
...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
0
@@ -167,6 +167,32 @@ class CachingTest < ActionController::IntegrationTest
0
     end
0
   end
0
 
0
+ def test_should_expire_new_assigned_section_to_article
0
+ visitor = visit
0
+ writer = login_as :quentin
0
+ visit_sections_and_feeds_with visitor
0
+ assert_expires_pages feed_url_for(:about) do
0
+ writer.revise contents(:site_map), 'sitemap whoo'
0
+ end
0
+
0
+ assert_cached section_url_for(:about) # paged section only shows the homepage
0
+ assert_cached section_url_for(:home)
0
+ assert_cached feed_url_for(:home)
0
+
0
+ assert_expires_pages section_url_for(:home), feed_url_for(:home), feed_url_for(:about) do
0
+ writer.revise contents(:site_map), :sections => [sections(:home), sections(:about)]
0
+ end
0
+ end
0
+
0
+ def test_should_expire_section_when_removing_from_article
0
+ visit_sections_and_feeds_with visit
0
+ assert_expires_pages section_url_for(:home), section_url_for(:about), feed_url_for(:home), feed_url_for(:about) do
0
+ login_as :quentin do |writer|
0
+ writer.revise contents(:site_map), :sections => [sections(:home)]
0
+ end
0
+ end
0
+ end
0
+
0
   protected
0
     def visit_sections_and_feeds_with(visitor)
0
       assert_difference CachedPage, :count, 4 do

Comments

    No one has commented yet.