Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Removed not needed soft deletion from PriceRule

Damian Legawiec4a155b8d819c
diff --git a/core/app/models/spree/price_rule.rb b/core/app/models/spree/price_rule.rb
index 440d1b9af5..23cf9dc744 100644
--- a/core/app/models/spree/price_rule.rb
+++ b/core/app/models/spree/price_rule.rb
@@ -1,20 +1,24 @@
module Spree
- class PriceRule < Spree::Base
- acts_as_paranoid
- include Spree::Preferences::Preferable
+ class PriceRule < Spree.base_class
+ belongs_to :price_list, class_name: 'Spree::PriceList', touch: true
- belongs_to :price_list, class_name: 'Spree::PriceList'
-
- validates :type, presence: true
+ validates :type, :price_list,presence: true
+ # Returns true if the price rule is applicable to the context
+ # @param context [Spree::Pricing::Context]
+ # @return [Boolean]
def applicable?(context)
raise NotImplementedError, "#{self.class.name} must implement #applicable?"
end
+ # Returns the human name of the price rule
+ # @return [String]
def self.human_name
name.demodulize.titleize
end
+ # Returns the description of the price rule
+ # @return [String]
def self.description
''
end
diff --git a/core/db/migrate/20251110120001_create_spree_price_rules.rb b/core/db/migrate/20251110120001_create_spree_price_rules.rb
index 7e1ad96256..3a4b9f4ef8 100644
--- a/core/db/migrate/20251110120001_create_spree_price_rules.rb
+++ b/core/db/migrate/20251110120001_create_spree_price_rules.rb
@@ -5,11 +5,9 @@ class CreateSpreePriceRules < ActiveRecord::Migration[7.0]
t.string :type, null: false
t.text :preferences
t.timestamps
- t.datetime :deleted_at
end
add_index :spree_price_rules, [:price_list_id, :type]
add_index :spree_price_rules, :type
- add_index :spree_price_rules, :deleted_at
end
end