This commit is contained in:
2026-04-18 05:39:37 +09:00
parent 9b46e97eaf
commit f4ee3070d6
2 changed files with 15 additions and 6 deletions
@@ -30,7 +30,9 @@ class PostVersionsController < ApplicationController
q = q.where('post_versions.post_id = ?', post_id) if post_id
if tag_name
escaped = ActiveRecord::Base.sanitize_sql_like(tag_name.name)
q = q.where("CONCAT(' ', post_versions.tags, ' ') LIKE ?", "% #{ escaped } %")
q = q.where(("CONCAT(' ', post_versions.tags, ' ') LIKE :kw " +
"OR CONCAT(' ', prev.tags, ' ') LIKE :kw"),
kw: "% #{ escaped } %")
end
count = q.except(:select, :order, :limit, :offset).count