From cfabee504f638def3c3bc9ddc50d3520509e168f Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 8 Apr 2021 00:34:06 +0100 Subject: [PATCH] Replace usage of changed? with saved_change_to_ --- app/models/spree/product.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/spree/product.rb b/app/models/spree/product.rb index 50e909bd4f..26214faceb 100755 --- a/app/models/spree/product.rb +++ b/app/models/spree/product.rb @@ -433,7 +433,7 @@ module Spree end def update_units - return unless variant_unit_changed? + return unless saved_change_to_variant_unit? option_types.delete self.class.all_variant_unit_option_types option_types << variant_unit_option_type if variant_unit.present? @@ -449,7 +449,7 @@ module Spree end def remove_previous_primary_taxon_from_taxons - return unless primary_taxon_id_changed? && primary_taxon_id_was + return unless saved_change_to_primary_taxon_id? && primary_taxon_id_was taxons.destroy(primary_taxon_id_was) end @@ -465,7 +465,7 @@ module Spree # Spree creates a permalink already but our implementation fixes an edge case. def sanitize_permalink - return unless permalink.blank? || permalink_changed? + return unless permalink.blank? || saved_change_to_permalink? requested = permalink.presence || permalink_was.presence || name.presence || 'product' self.permalink = create_unique_permalink(requested.parameterize)