diff --git a/lib/ash/resource/schema.ex b/lib/ash/resource/schema.ex index bdf8df3c..deff7ccc 100644 --- a/lib/ash/resource/schema.ex +++ b/lib/ash/resource/schema.ex @@ -69,11 +69,12 @@ defmodule Ash.Schema do for aggregate <- Ash.Resource.Info.aggregates(__MODULE__), aggregate.name not in Ash.Resource.reserved_names() do - if aggregate.kind == :custom do - {:ok, aggregate.type} - else - Aggregate.kind_to_type(aggregate.kind, :string) - end + {:ok, type} = + if aggregate.kind == :custom do + {:ok, aggregate.type} + else + Aggregate.kind_to_type(aggregate.kind, :string) + end field(aggregate.name, Ash.Type.ecto_type(type), virtual: true)