Commit 48e6193b authored by Ivan Tashkinov's avatar Ivan Tashkinov
Browse files

[#210] Refactoring.

parent 826fc446
......@@ -232,9 +232,7 @@ def update_media(%{assigns: %{user: _}} = conn, %{"media_id" => id} = data) do
with %Object{} = object <- Repo.get(Object, id), is_binary(description) do
new_data = Map.put(object.data, "name", description)
change = Object.change(object, %{data: new_data})
{:ok, _} = Repo.update(change)
{:ok, _} = object |> Object.change(%{data: new_data}) |> Repo.update()
end
conn
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment