Packages

This is a CMS written in Elixir. Aims to be the great open-source ecommerce and/or startup solution for those who are searching for a performance and stability on top of modern technologies like React and Elixir.

Current section

Files

Jump to
lyn web models feature.ex
Raw

web/models/feature.ex

defmodule Lyn.Feature do
use Lyn.Web, :model
schema "features" do
field :name, :string
field :active, :boolean, default: false
timestamps
end
def admin_fields do
[
id: %{
label: "id",
type: :integer
},
name: %{
label: "name",
type: :string
},
active: %{
label: "active",
type: :boolean
}
]
end
@required_fields ~w(name active)
@optional_fields ~w()
@doc """
Creates a changeset based on the `model` and `params`.
If no params are provided, an invalid changeset is returned
with no validation performed.
"""
def changeset(model, params \\ :empty) do
model
|> cast(params, @required_fields, @optional_fields)
end
end