legendary-doc-site/apps/content/lib/content/postmeta.ex

19 lines
381 B
Elixir
Raw Normal View History

defmodule Legendary.Content.Postmeta do
2020-07-20 22:04:04 +00:00
@moduledoc """
An item of metadata about a post.
"""
use Ecto.Schema
import Ecto.Changeset
2020-07-28 15:54:24 +00:00
schema "postmeta" do
belongs_to :post, Legendary.Content.Post
2020-07-28 15:54:24 +00:00
field :key, :string
field :value, :string
2020-07-20 22:04:04 +00:00
end
def changeset(struct, params \\ %{}) do
struct
2020-07-28 15:54:24 +00:00
|> cast(params, [:id, :post_id, :key, :value])
2020-07-20 22:04:04 +00:00
end
end