Skip to content

Commit

Permalink
Merge pull request #4 from myskoach/hotfix/suppport-missing-phoenix
Browse files Browse the repository at this point in the history
Ensure the Phoenix.HTML.Form module is loaded too
  • Loading branch information
mathieuprog authored Aug 27, 2020
2 parents 39926ac + 8c80c89 commit b00ab1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/html/form.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if Code.ensure_loaded?(Phoenix.HTML) do
if Code.ensure_loaded?(Phoenix.HTML) && Code.ensure_loaded?(Phoenix.HTML.Form) do
defmodule PolymorphicEmbed.HTML.Form do
import Phoenix.HTML, only: [html_escape: 1]
import Phoenix.HTML.Form, only: [hidden_inputs_for: 1]
Expand Down Expand Up @@ -119,7 +119,9 @@ if Code.ensure_loaded?(Phoenix.HTML) do
_ -> []
end

embed_data = Map.get(changeset.data, embed_field) || get_embed_struct(changeset, embed_field, embed_params)
embed_data =
Map.get(changeset.data, embed_field) ||
get_embed_struct(changeset, embed_field, embed_params)

embed_changeset =
%Ecto.Changeset{
Expand Down

0 comments on commit b00ab1e

Please sign in to comment.