View Source Elph.Contents.ContentType behaviour (elph v0.9.1)
This module provides macros to help with creation of custom content types.
Start with a schema freshly created by
mix phx.gen.schema Contents.Types.Markdown markdown_contents markdown:text
Now change some stuff in the <YourApp>.Contents.Types.Markdown
module.
- Add
use Ecto.Contents.ContentType
belowuse Ecto.Schema
. - Change
schema "markdown_contents" do
tocontent_schema "markdown_contents" do
. - Remove the
timestamps()
call in your schema as Elph already manages timestamps. - Write your
changeset
as you would usually and only care about your own stuff. Don't embed or cast the content. This is already handled.- Care! The function has to be called
changeset
so it can be called by Elph
- Care! The function has to be called