Add remarks to articles
This commit is contained in:
@ -12,6 +12,7 @@ defmodule Outlook.Articles.Article do
|
||||
field :language, :string, default: "EN"
|
||||
field :title, :string
|
||||
field :url, :string
|
||||
field :remarks, :string
|
||||
belongs_to :author, Author
|
||||
has_many :translations, Translation, on_delete: :delete_all
|
||||
|
||||
@ -21,7 +22,7 @@ defmodule Outlook.Articles.Article do
|
||||
@doc false
|
||||
def changeset(article, attrs) do
|
||||
article
|
||||
|> cast(attrs, [:title, :content, :url, :language, :date, :author_id])
|
||||
|> cast(attrs, [:title, :content, :url, :language, :date, :author_id, :remarks])
|
||||
|> validate_required([:title, :content, :url, :language, :date, :author_id])
|
||||
|> foreign_key_constraint(:author_id)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user