FIX: move draft cleanup to the dedicated method and add test

This commit is contained in:
Arpit Jalan
2015-06-03 14:35:54 +05:30
parent 34acb805a4
commit 725861f344
4 changed files with 13 additions and 14 deletions
+4
View File
@@ -41,6 +41,10 @@ class Draft < ActiveRecord::Base
WHERE s.draft_key = drafts.draft_key AND
s.user_id = drafts.user_id
)")
# remove old drafts
delete_drafts_older_than_n_days = SiteSetting.delete_drafts_older_than_n_days.days.ago
Draft.where("updated_at < ?", delete_drafts_older_than_n_days).destroy_all
end
end