From f9a333875576d948032b457154d2ab8e113fbbab Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 10 Jul 2018 10:01:18 +1000 Subject: [PATCH] Simplify serialiser with `delegate` --- .../api/admin/subscription_customer_serializer.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/serializers/api/admin/subscription_customer_serializer.rb b/app/serializers/api/admin/subscription_customer_serializer.rb index 6f8490abec..2cb10bf80a 100644 --- a/app/serializers/api/admin/subscription_customer_serializer.rb +++ b/app/serializers/api/admin/subscription_customer_serializer.rb @@ -6,13 +6,8 @@ module Api # Searches for a ship and bill addresses for the customer # where they are not already explicitly set class SubscriptionCustomerSerializer < CustomerSerializer - def bill_address - finder.bill_address - end - - def ship_address - finder.ship_address - end + delegate :bill_address, to: :finder + delegate :ship_address, to: :finder def finder @finder ||= OpenFoodNetwork::AddressFinder.new(object, object.email)