wiki pages: fix error in /wiki_pages/does_not_exist.json
This commit is contained in:
@@ -40,17 +40,19 @@ class WikiPagesController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
if params[:id] =~ /\A\d+\Z/
|
||||
if params[:id] =~ /\A\d+\z/
|
||||
@wiki_page = WikiPage.find(params[:id])
|
||||
else
|
||||
@wiki_page = WikiPage.find_by_title(params[:id])
|
||||
if @wiki_page.nil? && request.format.symbol == :html
|
||||
redirect_to show_or_new_wiki_pages_path(:title => params[:id])
|
||||
return
|
||||
end
|
||||
@wiki_page = WikiPage.titled(params[:id]).first
|
||||
end
|
||||
|
||||
if @wiki_page.present?
|
||||
respond_with(@wiki_page)
|
||||
elsif request.format.html?
|
||||
redirect_to show_or_new_wiki_pages_path(title: params[:id])
|
||||
else
|
||||
raise ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
Reference in New Issue
Block a user