diff options
author | cesartalves <cesartalvez@gmail.com> | 2021-04-15 15:05:54 -0300 |
---|---|---|
committer | cesartalves <cesartalvez@gmail.com> | 2021-04-19 12:41:58 -0300 |
commit | 9a9a681ea2e2d1f812267164733da40e1fd2d460 (patch) | |
tree | 8642d1af791e0df6a9a785659c5c8bafbff77635 | |
parent | 4d758f51852a081c13104129521547a1f8664649 (diff) |
Fix Spree::OrdersController decoration
The CreateSubscriptionLineItems decoration for the Front-end controller will break (obviously) if the Spree::OrdersController is not defined.
However, some users might want to use the extension using only the Backend and Core of Solidus.
This skips the decoration if Spree::Frontend is not defined
-rw-r--r-- | app/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb b/app/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb index 6b39b4c..394d025 100644 --- a/app/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb +++ b/app/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb @@ -32,4 +32,6 @@ module SolidusSubscriptions end end -Spree::OrdersController.prepend(SolidusSubscriptions::Spree::OrdersController::CreateSubscriptionLineItems) +if defined? Spree::Frontend + Spree::OrdersController.prepend(SolidusSubscriptions::Spree::OrdersController::CreateSubscriptionLineItems) +end |