This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
class WikiPagesController < ApplicationController
|
||||
def show
|
||||
wiki_page = WikiPage.find(params[:id])
|
||||
render json: wiki_page.as_json
|
||||
return head :not_found unless wiki_page
|
||||
|
||||
render json: wiki_page.as_json.merge(body: wiki_page.body)
|
||||
end
|
||||
|
||||
def show_by_title
|
||||
wiki_page = WikiPage.find_by(title: params[:title])
|
||||
body = wiki_page&.body
|
||||
return head :not_found unless body
|
||||
return head :not_found unless wiki_page
|
||||
|
||||
render plain: body
|
||||
render json: wiki_page.as_json.merge(body: wiki_page.body)
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -29,7 +30,7 @@ class WikiPagesController < ApplicationController
|
||||
return head :unauthorized unless current_user
|
||||
|
||||
wiki_page = WikiPage.find(params[:id])
|
||||
return head :not_found unless wiki_pages
|
||||
return head :not_found unless wiki_page
|
||||
|
||||
wiki_page.updated_user = current_user
|
||||
wiki_page.set_body params[:body], user: current_user
|
||||
|
||||
Reference in New Issue
Block a user