このコミットが含まれているのは:
2025-06-17 02:30:26 +09:00
コミット ceeefa9b7c
10個のファイルの変更180行の追加22行の削除
+12
ファイルの表示
@@ -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