There is no insert! function in the Food structure. And Foods should be the module used to create Food struct.
You cannot invent function name, it needs to exists in the file.
@doc """
Creates a food.
## Examples
iex> create_food(%{field: value})
{:ok, %Food{}}
iex> create_food(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_food(attrs \\ %{}) do
%Food{}
|> Food.changeset(attrs)
|> Repo.insert()
end
The closest is this one, and should be used like this…
DishOut.Foods.create_food(attrs)