Skip to content

Commit 691f8cb

Browse files
committed
Move decorators to patches/, configure Flickwerk
This stops us from loading line item, order, adjustment, shipment, shipping rate, and the order recalculator on app startup.
1 parent f712fb4 commit 691f8cb

File tree

7 files changed

+9
-6
lines changed

7 files changed

+9
-6
lines changed

promotions/app/decorators/models/solidus_promotions/adjustment_decorator.rb renamed to promotions/app/patches/models/solidus_promotions/adjustment_patch.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module SolidusPromotions
4-
module AdjustmentDecorator
4+
module AdjustmentPatch
55
def self.prepended(base)
66
base.scope :solidus_promotion, -> { where(source_type: "SolidusPromotions::Benefit") }
77
end

promotions/app/decorators/models/solidus_promotions/line_item_decorator.rb renamed to promotions/app/patches/models/solidus_promotions/line_item_patch.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module SolidusPromotions
4-
module LineItemDecorator
4+
module LineItemPatch
55
def self.prepended(base)
66
base.attr_accessor :quantity_setter
77
base.belongs_to :managed_by_order_benefit, class_name: "SolidusPromotions::Benefit", optional: true

promotions/app/decorators/models/solidus_promotions/order_decorator.rb renamed to promotions/app/patches/models/solidus_promotions/order_patch.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module SolidusPromotions
4-
module OrderDecorator
4+
module OrderPatch
55
module ClassMethods
66
def allowed_ransackable_associations
77
super + ["solidus_promotions", "solidus_order_promotions"]

promotions/app/decorators/models/solidus_promotions/order_recalculator_decorator.rb renamed to promotions/app/patches/models/solidus_promotions/order_recalculator_patch.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module SolidusPromotions
4-
module OrderRecalculatorDecorator
4+
module OrderRecalculatorPatch
55
# This is only needed for stores upgrading from the legacy promotion system.
66
# Once we've removed support for the legacy promotion system, we can remove this.
77
def recalculate

promotions/app/decorators/models/solidus_promotions/shipment_decorator.rb renamed to promotions/app/patches/models/solidus_promotions/shipment_patch.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module SolidusPromotions
4-
module ShipmentDecorator
4+
module ShipmentPatch
55
Spree::Shipment.prepend SolidusPromotions::DiscountableAmount
66

77
def reset_current_discounts

promotions/app/decorators/models/solidus_promotions/shipping_rate_decorator.rb renamed to promotions/app/patches/models/solidus_promotions/shipping_rate_patch.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module SolidusPromotions
4-
module ShippingRateDecorator
4+
module ShippingRatePatch
55
def self.prepended(base)
66
base.class_eval do
77
has_many :discounts,

promotions/lib/solidus_promotions/engine.rb

+3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
require "solidus_core"
44
require "solidus_support"
5+
require "flickwerk"
56

67
module SolidusPromotions
78
class Engine < Rails::Engine
89
include SolidusSupport::EngineExtensions
10+
include Flickwerk
11+
Flickwerk.aliases["Spree::Config.order_recalculator_class"] = Spree::Config.order_recalculator_class_name
912

1013
isolate_namespace ::SolidusPromotions
1114

0 commit comments

Comments
 (0)