diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index fbc03f467..b86cc2518 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -255,7 +255,7 @@ class Budget end def log_reclassification - self.previous_heading_id = self.heading_id_was + update_column(:previous_heading_id, heading_id_was) end def remove_reclassified_votes diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index 6486070bf..6010d5f5a 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -715,9 +715,13 @@ describe Budget::Investment do it "stores the previous heading before being reclassified" do investment = create(:budget_investment, heading: heading1) + expect(investment.heading_id).to eq(heading1.id) + expect(investment.previous_heading_id).to eq(nil) + investment.heading = heading2 investment.save + investment.reload expect(investment.heading_id).to eq(heading2.id) expect(investment.previous_heading_id).to eq(heading1.id) end