I am using mix phx.gen.html
, and I noticed following code:
def create_tag(attrs \\ %{}) do
%Tag{}
|> Tag.changeset(attrs)
|> Repo.insert()
end
def update_tag(%Tag{} = tag, attrs) do
tag
|> Tag.changeset(attrs)
|> Repo.update()
end
def change_tag(%Tag{} = tag, attrs \\ %{}) do
Tag.changeset(tag, attrs)
end
attrs
argument of create_tag
and change_tag
has a default value %{}
.
But, attrs
argument of update_tag
doesn’t. Why doesn’t it have the default value ? Is it removed on purpose?