From 826515874b480b7768d07809d76566402fb59ccf Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 11 Mar 2021 14:36:30 +0000 Subject: [PATCH] Replace some uses of #alias_method_chain --- app/controllers/admin/enterprise_groups_controller.rb | 5 ++--- app/controllers/admin/enterprises_controller.rb | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/enterprise_groups_controller.rb b/app/controllers/admin/enterprise_groups_controller.rb index ad1489e654..0691d9eeaa 100644 --- a/app/controllers/admin/enterprise_groups_controller.rb +++ b/app/controllers/admin/enterprise_groups_controller.rb @@ -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. diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index 87a3dff224..9b42b39174 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -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