fix channel creation errors

This commit is contained in:
byte[] 2019-12-31 19:54:19 -05:00
parent 9b22d2719a
commit 7473b92309
2 changed files with 4 additions and 5 deletions

View file

@ -38,10 +38,9 @@ defmodule Philomena.Channels.Channel do
@doc false @doc false
def changeset(channel, attrs) do def changeset(channel, attrs) do
tag_id = tag_id =
if attrs["artist_tag"] do case Repo.get_by(Tag, name: attrs["artist_tag"] || "") do
Repo.get_by(Tag, name: attrs["artist_tag"]).id %{id: id} -> id
else _ -> nil
nil
end end
channel channel

View file

@ -1,3 +1,3 @@
h1 Adding Channel h1 Adding Channel
= render PhilomenaWeb.ChannelView, "_form.html", changeset: @changeset, action: Routes.channel_path(@conn, :new), conn: @conn = render PhilomenaWeb.ChannelView, "_form.html", changeset: @changeset, action: Routes.channel_path(@conn, :create), conn: @conn