Class: PostsSweeper

Inherits:
ActionController::Caching::Sweeper
  • Object
show all
Defined in:
app/models/posts_sweeper.rb

Instance Method Summary collapse

Instance Method Details

#after_save(post) ⇒ Object Also known as: after_destroy



4
5
6
7
8
9
# File 'app/models/posts_sweeper.rb', line 4

def after_save(post)
  FileUtils.rm_rf File.join(RAILS_ROOT, 'public', 'forums', post.forum_id.to_s, 'posts.rss')
  FileUtils.rm_rf File.join(RAILS_ROOT, 'public', 'forums', post.forum_id.to_s, 'topics', "#{post.topic_id}.rss")
  FileUtils.rm_rf File.join(RAILS_ROOT, 'public', 'users')
  FileUtils.rm_rf File.join(RAILS_ROOT, 'public', 'posts.rss')
end