diff --git a/app/decorators/controllers/solidus_braintree/carts_controller_decorator.rb b/app/decorators/controllers/solidus_braintree/carts_controller_decorator.rb deleted file mode 100644 index f3e2e78d..00000000 --- a/app/decorators/controllers/solidus_braintree/carts_controller_decorator.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module SolidusBraintree - module CartsControllerDecorator - def self.prepended(base) - base.helper ::SolidusBraintree::BraintreeCheckoutHelper - end - - CartsController.prepend(self) - end -end diff --git a/app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb b/app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb deleted file mode 100644 index 0eba46ea..00000000 --- a/app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module SolidusBraintree - module CheckoutControllerDecorator - def self.prepended(base) - base.helper ::SolidusBraintree::BraintreeCheckoutHelper - end - - ::CheckoutsController.prepend(self) - end -end diff --git a/lib/generators/solidus_braintree/install/install_generator.rb b/lib/generators/solidus_braintree/install/install_generator.rb index b328f11c..cdd05d65 100644 --- a/lib/generators/solidus_braintree/install/install_generator.rb +++ b/lib/generators/solidus_braintree/install/install_generator.rb @@ -53,6 +53,18 @@ def setup_stylesheets " *= require spree/backend/solidus_braintree\n", before: %r{\*/}, verbose: true end + def inject_checkout_helper_to_frontend_controllers + inject_into_class 'app/controllers/checkouts_controller.rb', + 'CheckoutsController', + " helper SolidusBraintree::BraintreeCheckoutHelper\n\n", + verbose: true + + inject_into_class 'app/controllers/carts_controller.rb', + 'CartsController', + " helper SolidusBraintree::BraintreeCheckoutHelper\n\n", + verbose: true + end + def add_migrations rake 'railties:install:migrations FROM=solidus_braintree' end