Skip to content

Commit

Permalink
Inject SolidusBraintree dependencies into controllers
Browse files Browse the repository at this point in the history
Instead of monkeypatching the controllers, which the user already owns.

#102 (comment)
  • Loading branch information
gsmendoza committed Feb 17, 2023
1 parent 803c246 commit bd70d3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions lib/generators/solidus_braintree/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd70d3b

Please sign in to comment.