diff --git a/lib/type_id/ecto.ex b/lib/type_id/ecto.ex index c7d6fc9..4137fe2 100644 --- a/lib/type_id/ecto.ex +++ b/lib/type_id/ecto.ex @@ -114,11 +114,11 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do if primary_key do %{primary_key: primary_key, schema: schema, field: field, prefix: prefix, type: type} else - %{schema: schema, field: field, type: type} + %{schema: schema, field: field, type: type, prefix: prefix} end end - defp find_prefix(%{prefix: prefix}), do: prefix + defp find_prefix(%{prefix: prefix}) when not is_nil(prefix), do: prefix defp find_prefix(%{schema: schema, field: field}) do %{related: schema, related_key: field} = schema.__schema__(:association, field)