mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
fix channel creation errors
This commit is contained in:
parent
9b22d2719a
commit
7473b92309
2 changed files with 4 additions and 5 deletions
|
@ -38,10 +38,9 @@ defmodule Philomena.Channels.Channel do
|
|||
@doc false
|
||||
def changeset(channel, attrs) do
|
||||
tag_id =
|
||||
if attrs["artist_tag"] do
|
||||
Repo.get_by(Tag, name: attrs["artist_tag"]).id
|
||||
else
|
||||
nil
|
||||
case Repo.get_by(Tag, name: attrs["artist_tag"] || "") do
|
||||
%{id: id} -> id
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
channel
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue