Fix errors on /artists/show_or_new, /wiki_pages/show_or_new pages.

Fix these pages to redirect to the new page instead of erroring out when
a name or title isn't given.
This commit is contained in:
evazion
2019-08-21 23:57:12 -05:00
parent 1292e73931
commit 44653fb722
2 changed files with 8 additions and 2 deletions

View File

@@ -83,7 +83,10 @@ class ArtistsController < ApplicationController
def show_or_new
@artist = Artist.find_by_name(params[:name])
if @artist
if params[:name].blank?
redirect_to new_artist_path(artist_params(:new))
elsif @artist.present?
redirect_to artist_path(@artist)
else
@artist = Artist.new(name: params[:name])