Add Authors
mix phx.gen.live Authors Author authors name:string description:text homepage_name:string homepage_url:string
This commit is contained in:
20
lib/outlook/authors/author.ex
Normal file
20
lib/outlook/authors/author.ex
Normal file
@ -0,0 +1,20 @@
|
||||
defmodule Outlook.Authors.Author do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
schema "authors" do
|
||||
field :description, :string
|
||||
field :homepage_name, :string
|
||||
field :homepage_url, :string
|
||||
field :name, :string
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user