From f0d6078fd378c8b609e59d9bc51bf4d560492013 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Fri, 12 Aug 2022 14:52:44 +0200 Subject: [PATCH] Add consortium_uid and use for serializer --- app/models/provider.rb | 4 ++++ app/serializers/provider_serializer.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/app/models/provider.rb b/app/models/provider.rb index 54f850b19..d639570a4 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -552,6 +552,10 @@ def uid symbol.downcase end + def consortium_uid + consortium_id.downcase + end + def from_salesforce=(value) @from_salesforce = (value.to_s == "true") end diff --git a/app/serializers/provider_serializer.rb b/app/serializers/provider_serializer.rb index 3ca79adca..98b957e7b 100644 --- a/app/serializers/provider_serializer.rb +++ b/app/serializers/provider_serializer.rb @@ -47,6 +47,7 @@ class ProviderSerializer has_many :contacts, record_type: :contacts belongs_to :consortium, record_type: :providers, + id_method_name: :consortium_uid, serializer: ProviderSerializer, if: Proc.new { |provider| provider.consortium_id } has_many :consortium_organizations,