Skip to content
Browse files

Implement expire_children for DynamicContent

  • Loading branch information...
1 parent 3ba46ea commit 361622641f1ec56b56374fd0bdca223a96b50610 @kench kench committed Jan 5, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 app/models/dynamic_content.rb
View
9 app/models/dynamic_content.rb
@@ -65,5 +65,14 @@ def refresh_needed?
def refresh_content
true
end
+
+ # Remove stale dynamic content by expiring all child content.
+ # Sets the end_time of children to the current time.
+ def expire_children
+ self.children.each do |child|
+ child.end_time = DateTime.current
+ child.save
+ end
+ end
end

0 comments on commit 3616226

Please sign in to comment.
Something went wrong with that request. Please try again.