This commit is contained in:
2025-06-17 02:30:26 +09:00
parent 729bb5e4ca
commit ceeefa9b7c
10 changed files with 180 additions and 22 deletions
@@ -28,6 +28,7 @@ class WikiPagesController < ApplicationController
def update
return head :unauthorized unless current_user
return head :forbidden unless ['admin', 'member'].include?(current_user.role)
wiki_page = WikiPage.find(params[:id])
return head :not_found unless wiki_page
@@ -37,4 +38,15 @@ class WikiPagesController < ApplicationController
wiki_page.save!
head :ok
end
def search
q = WikiPage.all
if params[:title].present?
title = params[:title].to_s.strip
q = q.where('title LIKE ?', "%#{ WikiPage.sanitize_sql_like(title) }%")
end
render json: q.limit(20)
end
end