I have the following model. Do I have to include all field names in the cast or is there any default way to map all the fields in the params to model.
defmodule Chemical.Info do
use Chemical.Web, :model
schema "infos" do
field :title, :string
field :shortdesc, :string
field :longdesc, :string
field :images, :string
field :regions, :string
field :startdate, :date
field :enddate, :date
field :status, :string
field :createdby, :string
field :approvedby, :string
timestamps()
end
def changeset(model, params \\ :empty) do
model
|> cast(params, ["title", "shortdesc", "longdesc"])
end
end
Do I have to specify all the field names in the cast method to be copied into the model?