mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-01 03:46:44 +01:00
21 lines
471 B
Elixir
21 lines
471 B
Elixir
defmodule Philomena.StaticPages.StaticPage do
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
@derive {Phoenix.Param, key: :slug}
|
|
|
|
schema "static_pages" do
|
|
field :title, :string
|
|
field :slug, :string
|
|
field :body, :string
|
|
|
|
timestamps(inserted_at: :created_at, type: :utc_datetime)
|
|
end
|
|
|
|
@doc false
|
|
def changeset(static_page, attrs) do
|
|
static_page
|
|
|> cast(attrs, [:title, :slug, :body])
|
|
|> validate_required([:title, :slug, :body])
|
|
end
|
|
end
|