Skip to content

Commit

Permalink
Merge pull request #155 from mamhoff/fix-load-issues
Browse files Browse the repository at this point in the history
Remove SolidusBraintree::Spree namespace
  • Loading branch information
tvdeyen authored Jun 25, 2024
2 parents 35c899a + 1acde42 commit 62b181e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 33 deletions.
20 changes: 0 additions & 20 deletions app/decorators/models/solidus_braintree/spree/store_decorator.rb

This file was deleted.

13 changes: 0 additions & 13 deletions app/decorators/models/solidus_braintree/spree/user_decorator.rb

This file was deleted.

18 changes: 18 additions & 0 deletions app/decorators/models/solidus_braintree/spree_store_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module SolidusBraintree
module SpreeStoreDecorator
def self.prepended(base)
base.has_one :braintree_configuration, class_name: "SolidusBraintree::Configuration", dependent: :destroy
base.before_create :build_default_configuration
end

private

def build_default_configuration
build_braintree_configuration unless braintree_configuration
end

::Spree::Store.prepend self
end
end
11 changes: 11 additions & 0 deletions app/decorators/models/solidus_braintree/spree_user_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module SolidusBraintree
module SpreeUserDecorator
def self.prepended(base)
base.has_one :braintree_customer, class_name: 'SolidusBraintree::Customer', inverse_of: :user
end

::Spree.user_class.prepend self
end
end

0 comments on commit 62b181e

Please sign in to comment.