-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from mamhoff/fix-load-issues
Remove SolidusBraintree::Spree namespace
- Loading branch information
Showing
4 changed files
with
29 additions
and
33 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
app/decorators/models/solidus_braintree/spree/store_decorator.rb
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/decorators/models/solidus_braintree/spree/user_decorator.rb
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
app/decorators/models/solidus_braintree/spree_store_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
11
app/decorators/models/solidus_braintree/spree_user_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |