18 lines
271 B
Elixir
18 lines
271 B
Elixir
|
defmodule Demo.Accounts.User do
|
||
|
use Ecto.Schema
|
||
|
import Ecto.Changeset
|
||
|
|
||
|
schema "users" do
|
||
|
field :name, :string
|
||
|
|
||
|
timestamps()
|
||
|
end
|
||
|
|
||
|
@doc false
|
||
|
def changeset(user, attrs) do
|
||
|
user
|
||
|
|> cast(attrs, [:name])
|
||
|
|> validate_required([:name])
|
||
|
end
|
||
|
end
|