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