Files
phoenix-ausblick/lib/outlook/authors/author.ex
Thelonius Kort f7f1e1a284 Add Articles
mix phx.gen.live Articles Article articles title:string\                                                            /Crucial/git/phoenix-liveview-book
  content:text url:string language:string\
  date:utc_datetime author_id:references:authors
2022-12-26 18:02:29 +01:00

24 lines
536 B
Elixir

defmodule Outlook.Authors.Author do
use Ecto.Schema
import Ecto.Changeset
alias Outlook.Articles.Article
schema "authors" do
field :description, :string
field :homepage_name, :string
field :homepage_url, :string
field :name, :string
has_many :articles, Article
timestamps()
end
@doc false
def changeset(author, attrs) do
author
|> cast(attrs, [:name, :description, :homepage_name, :homepage_url])
|> validate_required([:name, :description, :homepage_name, :homepage_url])
end
end