     timestamps()
   end
 
-  @required_fields ~w(first_name last_name)
-  @optional_fields ~w()
-
-  def changeset(model, params \\ %{}) do
-    model
-    |> cast(params, @required_fields, @optional_fields)
+  @fields ~w(first_name last_name)a
+
+  def changeset(model, params \\ %{}) do
+    model
+    |> cast(params, @fields)
+    |> validate_required(@fields)
   end
 end
 

    has_many :roles, through: [:uses_roles, :user]
  end

  @required_fields ~w(email)
  @optional_fields ~w(name active)

  def changeset(model, params \\ %{}) do
    model
    |> cast(params, @required_fields, @optional_fields)
  end
end
defmodule TestExAdmin.Role do


  end

  @fields ~w(name description company user_id)a
  @required_fields ~w(name description)a

  def changeset(model, params \\ %{}) do
    model
    |> cast(params, @fields)
    |> validate_required(@required_fields)
  end
end

