From 5082c9ef8c9d5952287d671fc084c1a167ce80aa Mon Sep 17 00:00:00 2001 From: Kevin Xiwei Zheng Date: Thu, 27 Jun 2013 15:51:13 -0400 Subject: [PATCH] Fix creation of user records after janitor trials Previously, a negative "demoted from janitor trial" record would always be created after a janitor trial ended, regardless of whether or not the user in question was actually demoted or not. This commit removes the culprit, an overly aggressive after_destroy callback, and instead directly invokes user record creation in the "demote!" method. --- app/models/janitor_trial.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/janitor_trial.rb b/app/models/janitor_trial.rb index 1ec3ab20c..5b6fba2b1 100644 --- a/app/models/janitor_trial.rb +++ b/app/models/janitor_trial.rb @@ -3,7 +3,6 @@ class JanitorTrial < ActiveRecord::Base before_create :initialize_original_level after_create :send_dmail after_create :promote_user - after_destroy :create_feedback validates_presence_of :user before_validation :initialize_creator @@ -61,6 +60,7 @@ class JanitorTrial < ActiveRecord::Base def demote! user.update_column(:level, original_level) + self.create_feedback destroy end end