We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c57a335 commit b9b3145Copy full SHA for b9b3145
lib/polymorphic_embed.ex
@@ -388,13 +388,17 @@ defmodule PolymorphicEmbed do
388
389
module ->
390
data_for_field =
391
- Enum.find(list_data_for_field, fn
392
- %{id: id} = datum when not is_nil(id) ->
393
- id == params[:id] and datum.__struct__ == module
394
-
395
- _ ->
396
- nil
397
- end)
+ if list_data_for_field do
+ Enum.find(list_data_for_field, fn
+ %{id: id} = datum when not is_nil(id) ->
+ id == params[:id] and datum.__struct__ == module
+
+ _ ->
+ nil
398
+ end)
399
+ else
400
401
+ end
402
403
embed_changeset =
404
if data_for_field do
0 commit comments