Replace some uses of #alias_method_chain

This commit is contained in:
Matt-Yorkley
2021-03-11 14:36:30 +00:00
parent 55b0751c1a
commit 826515874b
2 changed files with 4 additions and 6 deletions

View File

@@ -25,15 +25,14 @@ module Admin
protected
def build_resource_with_address
enterprise_group = build_resource_without_address
def build_resource
enterprise_group = super
enterprise_group.address = Spree::Address.new
enterprise_group.address.country = Spree::Country.find_by(
id: Spree::Config[:default_country_id]
)
enterprise_group
end
alias_method_chain :build_resource, :address
# Overriding method on Spree's resource controller,
# so that resources are found using permalink.

View File

@@ -114,13 +114,12 @@ module Admin
protected
def build_resource_with_address
enterprise = build_resource_without_address
def build_resource
enterprise = super
enterprise.address ||= Spree::Address.new
enterprise.address.country ||= Spree::Country.find_by(id: Spree::Config[:default_country_id])
enterprise
end
alias_method_chain :build_resource, :address
# Overriding method on Spree's resource controller,
# so that resources are found using permalink