Skip to content

Commit

Permalink
method to cleanup drafts
Browse files Browse the repository at this point in the history
Signed-off-by: David A. Cuadrado <krawek@gmail.com>
  • Loading branch information
dcu committed Nov 26, 2010
1 parent 6636d6f commit ee28fef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/draft.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ class Draft
key :_id, String
key :question, Question
key :answer, Answer

def self.cleanup!
Draft.delete_all(:created_at.lt => 8.days.ago)
end
end
1 change: 1 addition & 0 deletions script/cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ENV['RAILS_ENV'] ||= (ARGV.first || 'development')
require File.dirname(__FILE__)+"/../config/environment"

ViewsCount.cleanup!
Draft.cleanup!

0 comments on commit ee28fef

Please sign in to comment.