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:
@@ -83,7 +83,10 @@ class ArtistsController < ApplicationController
|
|||||||
|
|
||||||
def show_or_new
|
def show_or_new
|
||||||
@artist = Artist.find_by_name(params[:name])
|
@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)
|
redirect_to artist_path(@artist)
|
||||||
else
|
else
|
||||||
@artist = Artist.new(name: params[:name])
|
@artist = Artist.new(name: params[:name])
|
||||||
|
|||||||
@@ -82,7 +82,10 @@ class WikiPagesController < ApplicationController
|
|||||||
|
|
||||||
def show_or_new
|
def show_or_new
|
||||||
@wiki_page = WikiPage.find_by_title(params[:title])
|
@wiki_page = WikiPage.find_by_title(params[:title])
|
||||||
if @wiki_page
|
|
||||||
|
if params[:title].blank?
|
||||||
|
redirect_to new_wiki_page_path(wiki_page_params(:create))
|
||||||
|
elsif @wiki_page.present?
|
||||||
redirect_to wiki_page_path(@wiki_page)
|
redirect_to wiki_page_path(@wiki_page)
|
||||||
else
|
else
|
||||||
@wiki_page = WikiPage.new(:title => params[:title])
|
@wiki_page = WikiPage.new(:title => params[:title])
|
||||||
|
|||||||
Reference in New Issue
Block a user