From 11ccb9a6d2fcae68e367441a5aa2e7c24ae6398f Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 21 Sep 2017 17:02:04 +1000 Subject: [PATCH] Revert "Fix for #1826, ensure that adjustment states are initialized prior to validation" This reverts commit d7de7d462fef56b486da20d7982876e63ba881a7. No longer required after we pulled in the correct migrations from Spree --- app/models/spree/adjustment_decorator.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/models/spree/adjustment_decorator.rb b/app/models/spree/adjustment_decorator.rb index bb4498c825..71a166aa56 100644 --- a/app/models/spree/adjustment_decorator.rb +++ b/app/models/spree/adjustment_decorator.rb @@ -6,8 +6,6 @@ module Spree has_one :metadata, class_name: 'AdjustmentMetadata' belongs_to :tax_rate, foreign_key: 'originator_id', conditions: "spree_adjustments.originator_type = 'Spree::TaxRate'" - before_validation :initialize_state - scope :enterprise_fee, where(originator_type: 'EnterpriseFee') scope :billable_period, where(source_type: 'BillablePeriod') scope :admin, where(source_type: nil, originator_type: nil) @@ -76,15 +74,5 @@ module Spree result end - private - - # Required after Spree Upgrade Step 6, as existing adjustments did not have - # a state, and so failed validation. New adjustments are not affected. - def initialize_state - return unless state.nil? - # (static: true) only updates state when not already set - # use (static: :force) to force initialization - initialize_state_machines(static: true) - end end end