Update the edit function in Links to support existing links.
This commit is contained in:
@@ -49,9 +49,9 @@ defmodule LinkShortener.Links do
|
|||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_one(%Link{} = link) do
|
def edit_one(%Link{} = link, attrs \\ %{}) do
|
||||||
link
|
link
|
||||||
|> Link.changeset(%{})
|
|> Link.changeset(attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_one(%Link{} = link, changes) do
|
def update_one(%Link{} = link, changes) do
|
||||||
|
|||||||
Reference in New Issue
Block a user