Skip to content

Commit b9e0c12

Browse files
committed
Promotions: Remove optional from belongs_to declarations
All of these have foreign key constraints set and are actually necessary for the respective records to function.
1 parent cf8ff04 commit b9e0c12

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

promotions/app/models/solidus_promotions/condition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module SolidusPromotions
66
class Condition < Spree::Base
77
include Spree::Preferences::Persistable
88

9-
belongs_to :benefit, class_name: "SolidusPromotions::Benefit", inverse_of: :conditions, optional: true
9+
belongs_to :benefit, class_name: "SolidusPromotions::Benefit", inverse_of: :conditions
1010
has_one :promotion, through: :benefit
1111

1212
scope :of_type, ->(type) { where(type: type) }

promotions/app/models/solidus_promotions/condition_product.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module SolidusPromotions
44
class ConditionProduct < Spree::Base
5-
belongs_to :condition, class_name: "SolidusPromotions::Condition", optional: true
6-
belongs_to :product, class_name: "Spree::Product", optional: true
5+
belongs_to :condition, class_name: "SolidusPromotions::Condition"
6+
belongs_to :product, class_name: "Spree::Product"
77
end
88
end

promotions/app/models/solidus_promotions/condition_store.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module SolidusPromotions
44
class ConditionStore < Spree::Base
5-
belongs_to :condition, class_name: "SolidusPromotions::Condition", optional: true
6-
belongs_to :store, class_name: "Spree::Store", optional: true
5+
belongs_to :condition, class_name: "SolidusPromotions::Condition"
6+
belongs_to :store, class_name: "Spree::Store"
77
end
88
end

promotions/app/models/solidus_promotions/condition_taxon.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module SolidusPromotions
44
class ConditionTaxon < Spree::Base
5-
belongs_to :condition, class_name: "SolidusPromotions::Condition", optional: true
6-
belongs_to :taxon, class_name: "Spree::Taxon", optional: true
5+
belongs_to :condition, class_name: "SolidusPromotions::Condition"
6+
belongs_to :taxon, class_name: "Spree::Taxon"
77
end
88
end

promotions/app/models/solidus_promotions/condition_user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module SolidusPromotions
44
class ConditionUser < Spree::Base
5-
belongs_to :condition, class_name: "SolidusPromotions::Condition", optional: true
6-
belongs_to :user, class_name: Spree::UserClassHandle.new, optional: true
5+
belongs_to :condition, class_name: "SolidusPromotions::Condition"
6+
belongs_to :user, class_name: Spree::UserClassHandle.new
77
end
88
end

0 commit comments

Comments
 (0)