Skip to content

Commit 406934b

Browse files
committed
Shipping Category: Add dependent: options
1 parent e6a57c3 commit 406934b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.rubocop_todo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-06-06 06:59:49 UTC using RuboCop version 1.76.0.
3+
# on 2025-06-06 10:32:23 UTC using RuboCop version 1.76.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -337,7 +337,7 @@ Rails/FilePath:
337337
- 'core/lib/spree/testing_support/dummy_app.rb'
338338
- 'sample/lib/spree/sample.rb'
339339

340-
# Offense count: 61
340+
# Offense count: 59
341341
# Configuration parameters: Include.
342342
# Include: **/app/models/**/*.rb
343343
Rails/HasManyOrHasOneDependent:

core/app/models/spree/shipping_category.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ class ShippingCategory < Spree::Base
55
self.allowed_ransackable_attributes = %w[name]
66

77
validates :name, presence: true
8-
has_many :products, inverse_of: :shipping_category
9-
has_many :shipping_method_categories, inverse_of: :shipping_category
8+
has_many :products, inverse_of: :shipping_category, dependent: :restrict_with_error
9+
has_many :shipping_method_categories, inverse_of: :shipping_category, dependent: :destroy
1010
has_many :shipping_methods, through: :shipping_method_categories
1111
end
1212
end

0 commit comments

Comments
 (0)