mirror of
https://github.com/sloanelybutsurely/typeid-elixir.git
synced 2024-11-28 01:42:54 -05:00
handle non-primary-key, non-assoc field (#39)
This commit is contained in:
parent
b0d53c117e
commit
1c0bd89955
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue