forum: fix exception when searching forum posts by title.
ex: https://danbooru.donmai.us/forum_posts?search[topic_title_matches]=test The is_deleted field wasn't qualified so it caused an ambiguous column error when the forum_posts table was joined with the forum_topics table.
This commit is contained in:
@@ -48,7 +48,7 @@ class ForumTopic < ApplicationRecord
|
||||
|
||||
module SearchMethods
|
||||
def active
|
||||
where("is_deleted = false")
|
||||
where(is_deleted: false)
|
||||
end
|
||||
|
||||
def permitted
|
||||
|
||||
@@ -57,7 +57,7 @@ class ForumPostsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
context "with search conditions" do
|
||||
should "list all matching forum posts" do
|
||||
get forum_posts_path, params: {:search => {:body_matches => "xxx"}}
|
||||
get forum_posts_path, params: { search: { body_matches: "xxx", topic_title_matches: "my forum topic" }}
|
||||
assert_response :success
|
||||
assert_select "#forum-post-#{@forum_post.id}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user