     model = defn.__struct__
     resource = conn.assigns.resource
     conn = Plug.Conn.assign(conn, :ea_required,
-       model.__struct__.resource_model.changeset(resource).required)
+       defn.resource_model.changeset(resource).required)
     {conn, params, resource} = handle_after_filter(conn, :new, defn, params, resource)
     contents = do_form_view(model, conn, resource, params)
 

  @moduledoc false
  use ExAdmin.Web, :controller
  require Logger
  import ExAdmin
  import ExAdmin.Utils
  import ExAdmin.ParamsToAtoms
  require IEx

    model = defn.__struct__
    resource = conn.assigns.resource
    conn = Plug.Conn.assign(conn, :ea_required,
       defn.resource_model.changeset(resource).required)
    {conn, params, resource} = handle_after_filter(conn, :edit, defn, params, resource)
    contents = do_form_view(model, conn, resource, params)

