I''m having a bear of a time getting my cached pages to expire. Maybe one of you guys can help me out. I''ll show my sweeper and then my log to show that it "should" be working. class PragmaticSweeper < ActionController::Caching::Sweeper observe Comment def after_save(comment) expire_page(comment.post_id) end private def expire_page(post_id) logger.error("I made it to the caching method in the SWEEPER!!!!!!") expire_action(:controller => ''pragmatic'', :action => ''view'', :id => post_id) end end and now here''s my log that shows that the expiration "should" be happening. SQL (0.000369) INSERT INTO comments (`name`, `raw_comment`, `date`, `post_id`, `web_site`, `comment`, `email`) VALUES(''bbbbbbbbbbbbbbbbb'', ''bbbbbbbbbbbbbbbbbbb'', ''2006-04-08 19:46:25'', 56, '''', ''bbbbbbbbbbbbbbbbbbb'', '''') I made it to the caching method in the SWEEPER!!!!!! Expired fragment: banjo.dnsdojo.org:9999/pragmatic/view/56 (0.00024) -- Posted via http://www.ruby-forum.com/.
Anyone got a clue? I''m stumped. charlie bowman wrote:> I''m having a bear of a time getting my cached pages to expire. Maybe > one of you guys can help me out. I''ll show my sweeper and then my log > to show that it "should" be working. > > class PragmaticSweeper < ActionController::Caching::Sweeper > observe Comment > def after_save(comment) > expire_page(comment.post_id) > end > private > def expire_page(post_id) > logger.error("I made it to the caching method in the SWEEPER!!!!!!") > expire_action(:controller => ''pragmatic'', > :action => ''view'', > :id => post_id) > end > end-- Posted via http://www.ruby-forum.com/.
I figured this one out on my own. Here''s the solution if for anyone who winds up googling the question. It boils down to not naming your expiration method the same name as the one used by the caching module. Duh!! I wasted way too much time this! class PragmaticSweeper < ActionController::Caching::Sweeper observe Comment def after_save(comment) expire_view_page(comment.post_id) end private def expire_view_page(post_id) logger.error("I made it to the caching method in the SWEEPER!!!!!!") expire_page(:controller => ''pragmatic'', :action => ''view'', :id => post_id) end end -- Posted via http://www.ruby-forum.com/.